コード例 #1
0
        private void btnWarehouse_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("WAREHOUSE", "");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtWarehouseCode.Text = frm.BaseMasterTable.Code;
                    txtWarehouseName.Text = frm.BaseMasterTable.Name;
                    txtWarehouseCode.Focus();
                    txtProductCode.Focus();
                }
            }
            frm.Dispose();
        }
コード例 #2
0
        private void btnProduct_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("PRODUCT", "");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtProduct.Text     = frm.BaseMasterTable.Code;
                    txtProductName.Text = frm.BaseMasterTable.Name;
                    txtProduct.Focus();
                    txtQuantity.Focus();
                }
            }
            frm.Dispose();
        }
コード例 #3
0
        private void btnSupplier_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("SUPPLIER", "");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtSupplierCode.Text = frm.BaseMasterTable.Code;
                    txtSupplierName.Text = frm.BaseMasterTable.Name;
                    txtSlipDateFrom.Focus();
                }
            }
            frm.Dispose();
            txtBalance.Text = CConvert.ToString(GetSupplierDepositBlanace(txtSupplierCode.Text.Trim()));
        }
コード例 #4
0
        private void btnReported_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("Customer", "TYPE = 2");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtReported.Text     = frm.BaseMasterTable.Code;
                    txtReportedName.Text = frm.BaseMasterTable.Name;
                    txtReported.Focus();
                    ReportedDate.Focus();
                }
            }
            frm.Dispose();
        }
コード例 #5
0
        private void btnCurrency_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("Currency", "");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtCurrencyCode.Text = frm.BaseMasterTable.Code;
                    txtCurrencyName.Text = frm.BaseMasterTable.Name;
                    txtCurrencyCode.Focus();
                    txtPrice.Focus();
                }
            }
            frm.Dispose();
        }
コード例 #6
0
        private void btnSupplier_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("Supplier", "");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtSupplierCode.Text = frm.BaseMasterTable.Code;
                    txtSupplierName.Text = frm.BaseMasterTable.Name;
                    txtSupplierCode.Focus();
                    txtProductCode.Focus();
                }
            }
            frm.Dispose();
        }
コード例 #7
0
        private void btnDrawingType5_Click(object sender, EventArgs e)
        {
            FrmMasterSearch frm = new FrmMasterSearch("DRAWING", "");

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                if (frm.BaseMasterTable != null)
                {
                    txtDrawingType5.Text     = frm.BaseMasterTable.Name;
                    txtDrawingTypeCode5.Text = frm.BaseMasterTable.Code;

                    //btnDrawingType6.Enabled = true;

                    btnSave.Focus();
                }
            }
            frm.Dispose();
        }
コード例 #8
0
ファイル: FrmTransferReceipt.cs プロジェクト: zhr008/ERP-1
 private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == dgvData.Columns["BtnProduct"].Index)
         {
             FrmMasterSearch frm = new FrmMasterSearch("PRODUCT", "");
             if (frm.ShowDialog(this) == DialogResult.OK)
             {
                 if (frm.BaseMasterTable != null)
                 {
                     DataGridViewRow  dr           = dgvData.Rows[e.RowIndex];
                     string           code         = frm.BaseMasterTable.Code;
                     BaseProductTable productTable = bProduct.GetModel(code);
                     BaseStockTable   stock        = bStock.GetModel(txtDepartualCode.Text.Trim(), productTable.CODE);
                     BAlloation       bAlloation   = new BAlloation();
                     if (productTable != null)
                     {
                         dr.Cells["PRODUCT_CODE"].Value = productTable.CODE;
                         dr.Cells["PRODUCT_NAME"].Value = productTable.NAME;
                         decimal alloationQuantity = bAlloation.GetAlloationQuantity(txtDepartualCode.Text.Trim(), productTable.CODE);
                         dr.Cells["QUANTITY"].Value          = stock.QUANTITY - alloationQuantity;
                         dr.Cells["UNIT_NAME"].Value         = bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE).Name;
                         dr.Cells["UNIT_CODE"].Value         = productTable.BASIC_UNIT_CODE;
                         dr.Cells["TRANSFER_QUANTITY"].Value = "1";
                     }
                     else
                     {
                         MessageBox.Show("商品不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         dr.Cells["QUANTITY"].Value = "0";
                         dr.Cells["CODE"].Selected  = true;
                     }
                 }
             }
             frm.Dispose();
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #9
0
 private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == dgvData.Columns["BtnProduct"].Index)
         {
             StringBuilder sb = new StringBuilder();
             sb.Append(" (PRODUCT_FLAG = 2 OR PRODUCT_FLAG = 4)");
             sb.AppendFormat(" AND SUPPLIER_CODE LIKE '%{0}%'", txtSupplierCode.Text.Trim());
             FrmMasterSearch frm = new FrmMasterSearch("PRODUCT", sb.ToString());
             if (frm.ShowDialog(this) == DialogResult.OK)
             {
                 if (frm.BaseMasterTable != null)
                 {
                     DataGridViewRow  dr           = dgvData.Rows[e.RowIndex];
                     string           code         = frm.BaseMasterTable.Code;
                     BaseProductTable productTable = bProduct.GetModel(code);
                     string           taxation     = cboTax.Text.Replace("%", "");
                     if (productTable != null)
                     {
                         if (!productTable.CODE.Equals(dr.Cells["OLD_CODE"].Value)) //商品编号未变换
                         {
                             dr.Cells["PRODUCT_CODE"].Value = productTable.CODE;
                             dr.Cells["OLD_CODE"].Value     = productTable.CODE;
                             dr.Cells["NAME"].Value         = productTable.NAME;
                             dr.Cells["SPEC"].Value         = productTable.SPEC + " " + productTable.MODEL_NUMBER;
                             dr.Cells["QUANTITY"].Value     = 1;
                             if (bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE) != null)
                             {
                                 dr.Cells["UNIT_NAME"].Value = bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE).Name;
                             }
                             dr.Cells["UNIT_CODE"].Value           = productTable.BASIC_UNIT_CODE;
                             dr.Cells["PRICE"].Value               = productTable.PURCHASE_PRICE;
                             dr.Cells["AMOUNT"].Value              = productTable.PURCHASE_PRICE;
                             dr.Cells["AMOUNT_INCLUDED_TAX"].Value = productTable.PURCHASE_PRICE * (1 + CConvert.ToDecimal(cboTax.Text.Replace("%", "")) / 100);
                             CalculateAmount();
                         }
                     }
                     else
                     {
                         MessageBox.Show("外购件不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         dr.Cells["PRODUCT_CODE"].Value        = "";
                         dr.Cells["NAME"].Value                = "";
                         dr.Cells["SPEC"].Value                = "";
                         dr.Cells["QUANTITY"].Value            = "0";
                         dr.Cells["UNIT_NAME"].Value           = "";
                         dr.Cells["UNIT_CODE"].Value           = "";
                         dr.Cells["PRICE"].Value               = "0";
                         dr.Cells["AMOUNT"].Value              = "0";
                         dr.Cells["AMOUNT_INCLUDED_TAX"].Value = "0";
                         //dr.Cells["CODE"].Selected = true;
                         CalculateAmount();
                     }
                 }
             }
             frm.Dispose();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #10
0
        private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == dgvData.Columns["BTN_DELETE"].Index)
                {
                    if (MessageBox.Show("确定要删除当前行吗?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                    {
                        if (dgvData.Rows.Count != 1)
                        {
                            dgvData.Rows.Remove(dgvData.Rows[e.RowIndex]);
                        }
                        else
                        {
                            dgvData.Rows.Remove(dgvData.Rows[e.RowIndex]);
                            dgvData.Rows.Add(1);
                        }
                        CalculateAmount();
                    }
                }
                else if (e.ColumnIndex == dgvData.Columns["BTN_CODE"].Index)
                {
                    FrmMasterSearch frm = new FrmMasterSearch("SLIP_TYPE", "");
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        if (frm.BaseMasterTable != null)
                        {
                            dgvData.Rows[e.RowIndex].Cells["CODE"].Value     = frm.BaseMasterTable.Code;
                            dgvData.Rows[e.RowIndex].Cells["NAME"].Value     = frm.BaseMasterTable.Name;
                            dgvData.Rows[e.RowIndex].Cells["METERIAL"].Value = "铸钢(ZG270-500)";
                            dgvData.Rows[e.RowIndex].Cells["SPEC"].Selected  = true;

                            NewRow();
                        }
                    }
                    frm.Dispose();
                }
                else if (e.ColumnIndex == dgvData.Columns["BTN_METERIAL"].Index)
                {
                    FrmMasterSearch frm = new FrmMasterSearch("MATERIAL", "");
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        if (frm.BaseMasterTable != null)
                        {
                            //dgvData.Rows[e.RowIndex].Cells["CODE"].Value = frm.BaseMasterTable.Code;
                            dgvData.Rows[e.RowIndex].Cells["METERIAL"].Value = frm.BaseMasterTable.Name;

                            NewRow();
                        }
                    }
                    frm.Dispose();
                }
                else if (e.ColumnIndex == dgvData.Columns["BTN_PARTS_CODE"].Index)
                {
                    bool b = CConvert.ToBoolean(this.dgvData.Rows[e.RowIndex].Cells["checkboxflag"].Value);
                    if (b)
                    {
                        string str = dgvData.Rows[e.RowIndex].Cells["CODE"].Value.ToString();

                        StringBuilder sb = new StringBuilder();
                        sb.AppendFormat("SLIP_TYPE_CODE = '{0}'", str);
                        FrmMasterSearch frm = new FrmMasterSearch("SLIP_TYPE_COMPOSITION_PRODUCTS_VIEW", sb.ToString());
                        if (frm.ShowDialog(this) == DialogResult.OK)
                        {
                            if (frm.BaseMasterTable != null)
                            {
                                dgvData.Rows[e.RowIndex].Cells["COMPOSITION_PRODUCTS_CODE"].Value = frm.BaseMasterTable.Code;
                                dgvData.Rows[e.RowIndex].Cells["COMPOSITION_PRODUCTS_NAME"].Value = frm.BaseMasterTable.Name;

                                if (dgvData.Rows.Count > 1)
                                {
                                    if (dgvData.Rows[e.RowIndex].Cells["COMPOSITION_PRODUCTS_NAME"].Value.ToString() != "")
                                    {
                                        dgvData.Rows[e.RowIndex].Cells["SPEC"].Value        = dgvData.Rows[e.RowIndex - 1].Cells["SPEC"].Value;
                                        dgvData.Rows[e.RowIndex].Cells["DESCRIPTION"].Value = dgvData.Rows[e.RowIndex - 1].Cells["DESCRIPTION"].Value;
                                    }
                                }
                                NewRow();
                            }
                        }
                        frm.Dispose();
                    }
                }
            }
            catch { }
        }