Ejemplo n.º 1
0
        void txtMa_Thue_Validating(object sender, CancelEventArgs e)
        {
            string strValue = txtMa_Thue.Text;
            bool   bRequire = false;

            string strMa_Thue_Old = drEditPh["Ma_Thue"] == DBNull.Value ? string.Empty : (string)drEditPh["Ma_Thue"];

            //frmThue frmLookup = new frmThue();
            DataRow drLookup = Lookup.ShowLookup("Ma_Thue", strValue, bRequire, "");

            if (bRequire && drLookup == null)
            {
                e.Cancel = true;
            }

            if (drLookup == null)
            {
                numTTien_Nt3.bReadOnly = true;
                numTTien3.bReadOnly    = true;

                numTTien_Nt3.TabStop = false;
                numTTien3.TabStop    = false;

                txtMa_Thue.Text = string.Empty;
            }
            else
            {
                numTTien_Nt3.bReadOnly = false;
                numTTien3.bReadOnly    = false;

                numTTien_Nt3.TabStop = true;
                numTTien3.TabStop    = true;

                string strMa_Thue = (string)drLookup["Ma_Thue"];
                txtMa_Thue.Text = strMa_Thue;

                if (strMa_Thue != strMa_Thue_Old)
                {
                    //Đưa Thue_Gtgt vào drEditPh vào để cập nhật xuống Detail
                    this.drEditPh["Thue_Gtgt"] = drLookup["Thue_Suat"];
                }

                string  strMa_Dt = txtMa_Dt.Text;
                DataRow drDmDt   = DataTool.SQLGetDataRowByID("LIDOITUONG", "Ma_Dt", strMa_Dt);

                dicName.SetValue("Ten_Thue", drLookup["Ten_Thue"].ToString());
            }

            Voucher.Update_Detail(this, "Ma_Thue, Thue_Gtgt");
            Voucher.Calc_Thue_Vat_All(this);
            Voucher.Calc_Thue_Vat_All(this);

            if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible)
            {
                ((txtTextLookup)sender).AutoFilter.Visible = false;
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
            }
        }