Beispiel #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"];

            //
            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.Adjust_TThue_Vat(this, true);
            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);
            }
        }
Beispiel #2
0
        private void TTien_Valid()
        {
            numTTien0.Value = numTTien_Nt0.Value * numTy_Gia.Value;

            if (numTTien3.Value == 0)
            {
                numTTien3.Value = numTTien_Nt3.Value * numTy_Gia.Value;
            }
            else if (numTTien_Nt3.Value == 0 && numTy_Gia.Value != 0)
            {
                numTTien_Nt3.Value = numTTien3.Value / numTy_Gia.Value;
            }

            this.drEditPh["TTien0"]    = numTTien0.Value;
            this.drEditPh["TTien_Nt0"] = numTTien_Nt0.Value;
            this.drEditPh["TTien3"]    = numTTien3.Value;
            this.drEditPh["TTien_Nt3"] = numTTien_Nt3.Value;

            this.drEditPh["TTien"]    = Convert.ToDouble(this.drEditPh["TTien0"]) + Convert.ToDouble(this.drEditPh["TTien3"]);
            this.drEditPh["TTien_Nt"] = Convert.ToDouble(this.drEditPh["TTien_Nt0"]) + Convert.ToDouble(this.drEditPh["TTien_Nt3"]);

            Voucher.Adjust_TThue_Vat(this);
        }
Beispiel #3
0
        private void Ma_Tte_Valid()
        {
            string strMa_Tte = txtMa_Tte.Text.Trim();

            if (Common.Inlist(this.strMa_Ct, (string)Epoint.Systems.Librarys.Parameters.GetParaValue("CT_LOCKED_EXCHANGE")))
            {
                numTy_Gia.Enabled = false;
            }
            else
            {
                numTy_Gia.Enabled = true;
            }

            if (Element.sysMa_Tte == strMa_Tte)
            {
                numTy_Gia.Value     = 1;
                numTy_Gia.bReadOnly = true;

                this.pnlTTien.Visible = false;
                this.pnlTTien_Nt.Left = this.pnlTTien.Right - this.pnlTTien_Nt.Width;

                if (dgvEditCt1.Columns.Contains("TIEN"))
                {
                    dgvEditCt1.Columns["TIEN"].Visible = false;
                }

                //if (dgvEditCt2.Columns.Contains("TIEN3"))
                //    dgvEditCt2.Columns["TIEN3"].Visible = false;

                if (dgvEditCt1.Columns.Contains("TIEN5"))
                {
                    dgvEditCt1.Columns["TIEN5"].Visible = false;
                }
            }
            else
            {
                numTy_Gia.bReadOnly = false;

                if (dteNgay_Ct.Text != Library.DateToStr((DateTime)drEditPh["Ngay_Ct"]) || txtMa_Tte.bTextChange)
                {
                    Hashtable ht = new Hashtable();
                    ht.Add("NGAY_CT", Library.StrToDate(dteNgay_Ct.Text));
                    ht.Add("MA_TTE", strMa_Tte);

                    numTy_Gia.Value = Convert.ToDouble(SQLExec.ExecuteReturnValue("sp_GetTyGia", ht, CommandType.StoredProcedure));
                }

                this.pnlTTien.Visible = true;
                this.pnlTTien_Nt.Left = this.pnlTTien.Left - this.pnlTTien_Nt.Width;

                if (dgvEditCt1.Columns.Contains("TIEN"))
                {
                    dgvEditCt1.Columns["TIEN"].Visible = true;
                }

                //if (dgvEditCt2.Columns.Contains("TIEN3"))
                //    dgvEditCt2.Columns["TIEN3"].Visible = true;

                if (dgvEditCt1.Columns.Contains("TIEN5"))
                {
                    dgvEditCt1.Columns["TIEN5"].Visible = true;
                }
            }

            if (dteNgay_Ct.Text != Library.DateToStr((DateTime)drEditPh["Ngay_Ct"]) || txtMa_Tte.bTextChange || numTy_Gia.bTextChange)
            {
                Voucher.Update_Detail(this);
                Voucher.Calc_Tien_All(this);
                Voucher.Adjust_TThue_Vat(this, true);

                if (txtMa_Tte.bTextChange)
                {
                    txtMa_Tte.bTextChange = false;
                }
            }

            numTTien_Nt.Scale = numTTien_Nt0.Scale = numTTien_Nt3.Scale = strMa_Tte == Element.sysMa_Tte ? 0 : 2;

            Voucher.FormatTien_Nt(dgvEditCt1, strMa_Tte);

            dgvEditCt1.ResizeGridView();
        }