示例#1
1
 public static void SetDateEditFormat(DateEdit dateEdit)
 {
     dateEdit.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
     dateEdit.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
     dateEdit.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
     dateEdit.Properties.EditFormat.FormatString = "dd/MM/yyyy";
     dateEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTimeAdvancingCaret;
     dateEdit.Properties.Mask.EditMask = "dd/MM/yyyy";
 }
 /// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.dateEdit1 = new DevExpress.XtraEditors.DateEdit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties.VistaTimeProperties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).BeginInit();
     this.SuspendLayout();
     //
     // dateEdit1
     //
     this.dateEdit1.Dock = System.Windows.Forms.DockStyle.Fill;
     this.dateEdit1.EditValue = null;
     this.dateEdit1.Location = new System.Drawing.Point(0, 0);
     this.dateEdit1.Name = "dateEdit1";
     this.dateEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
     new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
     this.dateEdit1.Properties.ReadOnly = true;
     this.dateEdit1.Properties.VistaTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
     new DevExpress.XtraEditors.Controls.EditorButton()});
     this.dateEdit1.Size = new System.Drawing.Size(150, 20);
     this.dateEdit1.TabIndex = 0;
     //
     // txtNgayHeThong
     //
     this.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.Appearance.Options.UseFont = true;
     this.Controls.Add(this.dateEdit1);
     this.Name = "txtNgayHeThong";
     this.Size = new System.Drawing.Size(150, 20);
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties.VistaTimeProperties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).EndInit();
     this.ResumeLayout(false);
 }
示例#3
0
        private FormTemplatePreview(List<ReportParam> prms)
        {
            InitializeComponent();

            foreach (ReportParam tp in prms)
            {
                BaseEdit ctrl = null;
                switch (tp.PType)
                {
                    case ReportParamTypes.TamSayý:
                        SpinEdit se = new SpinEdit();
                        ctrl = se;
                        break;
                    case ReportParamTypes.Tarih:
                        ctrl = new DateEdit();
                        break;
                    case ReportParamTypes.Metin:
                        ctrl = new TextEdit();
                        break;
                    case ReportParamTypes.OndalikliSayi:
                        ctrl = new SpinEdit();
                        break;
                    case ReportParamTypes.EvetHayir:
                        ctrl = new CheckEdit();
                        break;
                    case ReportParamTypes.Entity:
                        LookUp lu = new LookUp();
                        lu.EntityType = DMT.Provider.GetEntityType(tp.PModuleName, tp.PEntityName);
                        lu.DisplayFieldName = tp.PDisplayField;
                        lu.ValueFieldName = tp.PValueField;
                        ctrl = lu;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
                ctrl.Name = tp.PName;
                LayoutControl.AddItem(tp.Name, ctrl);
            }
        }
 // Tháng trước
 private void Thangtruoc(DateEdit tungay, DateEdit denngay)
 {
     tungay.EditValue = DateTime.Now.AddMonths(-1);
     denngay.EditValue = DateTime.Now;
 }
 private void Quyhientai(DateEdit tungay, DateEdit denngay)
 {
     DateTime ngaydauquy = HelpDate.GetStartOfCurrentQuarter();
     tungay.EditValue = ngaydauquy;
     DateTime ngaycuoiquy = HelpDate.GetEndOfCurrentQuarter();
     denngay.EditValue = ngaycuoiquy;
 }
 // Ngày đầu tháng đến nay
 private void Ngaydauthangdennay(DateEdit tungay, DateEdit denngay)
 {
     DateTime ngaydauthang = HelpDate.GetStartOfCurrentMonth();
     tungay.EditValue = ngaydauthang;
     denngay.EditValue = DateTime.Now;
 }
示例#7
0
文件: frmMain.cs 项目: wangboc/Arache
        private void InitChargeDateCustomCtr()
        {
            TableLayoutPanel panel = new TableLayoutPanel();
            panel.Dock = DockStyle.Fill;
            panel.BorderStyle = BorderStyle.FixedSingle;
            panel.RowCount = 4;
            panel.ColumnCount = 2;
            panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
            panel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
            panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 25));
            panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 25));
            panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 25));
            panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 25));
            Label starttimeLabel = new Label();
            starttimeLabel.Text = "计费开始时间:";
            starttimeLabel.TextAlign = ContentAlignment.MiddleRight;
            Label middletimeLabel = new Label();
            middletimeLabel.Text = "第一次计费时间:";
            middletimeLabel.TextAlign = ContentAlignment.MiddleRight;
            Label lasttimeLabel = new Label();
            lasttimeLabel.Text = "第二次计费时间:";
            lasttimeLabel.TextAlign = ContentAlignment.MiddleRight;
            DateEdit startDate = new DateEdit();
            startDate.Dock = DockStyle.Fill;
            startDate.Name = "startDate";
            startDate.EditValue = DateTime.Now;
            startDate.Properties.CalendarView = CalendarView.Vista;
            startDate.Properties.VistaDisplayMode = DefaultBoolean.True;
            startDate.Properties.DisplayFormat.FormatString = "yyyy/MM/dd HH:mm:ss";
            startDate.Properties.VistaEditTime = DefaultBoolean.True;
            startDate.Properties.EditMask = "yyyy/MM/dd HH:mm:ss";
            DateEdit middleDate = new DateEdit();
            middleDate.Name = "middleDate";
            middleDate.Dock = DockStyle.Fill;
            middleDate.EditValue = DateTime.Now;
            middleDate.Properties.CalendarView = CalendarView.Vista;
            middleDate.Properties.VistaDisplayMode = DefaultBoolean.True;
            middleDate.Properties.DisplayFormat.FormatString = "yyyy/MM/dd HH:mm:ss";
            middleDate.Properties.EditMask = "yyyy/MM/dd HH:mm:ss";
            middleDate.Properties.VistaEditTime = DefaultBoolean.True;
            panel.Controls.Add(starttimeLabel, 0, 0);
            DateEdit lastDate = new DateEdit();
            lastDate.Dock = DockStyle.Fill;
            lastDate.Name = "lastDate";
            lastDate.EditValue = DateTime.Now;
            lastDate.Properties.CalendarView = CalendarView.Vista;
            lastDate.Properties.VistaDisplayMode = DefaultBoolean.True;
            lastDate.Properties.DisplayFormat.FormatString = "yyyy/MM/dd HH:mm:ss";
            lastDate.Properties.EditMask = "yyyy/MM/dd HH:mm:ss";
            lastDate.Properties.VistaEditTime = DefaultBoolean.True;
            panel.Controls.Add(starttimeLabel, 0, 0);
            panel.Controls.Add(middletimeLabel, 0, 1);
            panel.Controls.Add(lasttimeLabel, 0, 2);
            panel.Controls.Add(startDate, 1, 0);
            panel.Controls.Add(middleDate, 0, 1);
            panel.Controls.Add(lastDate, 1, 2);
            TableLayoutPanel panelInside = new TableLayoutPanel();
            panelInside.RowCount = 1;
            panelInside.ColumnCount = 4;
            SimpleButton btnOK = new SimpleButton();
            btnOK.Text = "确定";
            btnOK.Click += btnOK_Click;
            btnOK.Dock = DockStyle.Right;
            SimpleButton btnCancel = new SimpleButton();
            btnCancel.Text = "取消";
            btnCancel.Dock = DockStyle.Right;
            panelInside.Controls.Add(btnOK, 2, 0);
            panelInside.Controls.Add(btnCancel, 3, 0);
            btnCancel.Click += btnCancel_Click;
            panel.Controls.Add(panelInside, 1, 3);

            popup.Width = 300;
            popup.Height = 110;
            popup.Controls.Add(panel);

            ChargeDateSelectBtn.DropDownControl = popup;
        }
示例#8
0
        //method
        public void ProcessInfo(TextBox tb4, TextBox tb, TextBox tb1, TextBox tb2, TextBox tb3, DateEdit jDate, PictureBox img)
        {
            if (tb4.Text == "id" || tb3.Text == "Address" || (tb2.Text == "Age" || (Convert.ToInt16(tb2.Text) > 90) || Convert.ToInt16(tb2.Text) < 12) || tb1.Text == "Father Name" || tb.Text == "Name")
            {
                MessageBox.Show("Error! Please provide the required information.\\nTry Again.", "Error!");
            }
            else
            {
                Id          = Convert.ToInt16(tb4.Text);
                Name        = tb.Text;
                FatherName  = tb1.Text;
                Age         = Convert.ToInt16(tb2.Text);
                Address     = tb3.Text;
                JoiningDate = jDate.DateTime;
                Photo       = img.Image;


                //messagebox print the info to confirm it's working
                //MessageBox.Show(Id+Name+FatherName+Age+Address+JoiningDate);


                // sql operations
                //var connectionString = @"Data Source=(localdb)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\Database.Database1.mdf;Integrated Security=True;";
                string connectionString = ConfigurationManager.ConnectionStrings["DynamicGym"].ConnectionString;
                using (SqlConnection connect = new SqlConnection(connectionString))
                    using (SqlCommand cmd = new SqlCommand())
                        using (MemoryStream ms = new MemoryStream())
                        {
                            // code to add image to the database

                            Photo.Save(ms, Photo.RawFormat);
                            byte[] trainerImg = ms.GetBuffer();
                            ms.Close();

                            // set parameters
                            cmd.Connection = connect;
                            cmd.Parameters.Clear();
                            cmd.Parameters.AddWithValue("@Photo", trainerImg);
                            cmd.CommandText = "insert into Trainers (id, name, fatherName, age, adress, joiningDate, photo) values ('" + Id + "' ,'" + Name + "' , '" + FatherName + "','" + Age + "','" + Address + "','" + JoiningDate + "',@Photo)";

                            // open connection to the database
                            connect.Open();
                            try
                            {
                                // execute query
                                cmd.ExecuteNonQuery();

                                // close the connection
                                connect.Close();

                                MessageBox.Show("Record inserted successfully!", "Messgae");
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }
            }
        }
示例#9
0
        public void loadstart(DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, LookUpEdit ledv, DateEdit denct, DateEdit denht, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang,
                              DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit chiphi, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, LookUpEdit ledt, ToolStripButton tsbtsua, ToolStripButton tsbtxoa,
                              ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, DataTable dt, string tsbt, string userid, ComboBoxEdit cbthue, DataTable khach, DataTable hang)
        {
            cbthue.Properties.Items.Clear();
            cbthue.Properties.Items.Add("0");
            cbthue.Properties.Items.Add("5");
            cbthue.Properties.Items.Add("10");

            DataTable da   = new DataTable();
            DataTable temp = new DataTable();

            temp.Columns.Add("Mã kho");
            temp.Columns.Add("Tên kho");
            temp.Columns.Add("Tên đơn vị");
            da = gen.GetTable("select StockCode, StockName,BranchName from Stock a, Branch b where a.BranchID=b.BranchID and StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') order by BranchName,StockCode");
            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dr = temp.NewRow();
                dr[0] = da.Rows[i][0].ToString();
                dr[1] = da.Rows[i][1].ToString();
                dr[2] = da.Rows[i][2].ToString();
                temp.Rows.Add(dr);
            }
            ledv.Properties.DataSource    = temp;
            ledv.Properties.DisplayMember = "Mã kho";
            ledv.Properties.ValueMember   = "Mã kho";
            ledv.Properties.PopupWidth    = 400;


            /* DataTable temp4 = new DataTable();
             * temp4.Columns.Add("Mã đối tượng");
             * temp4.Columns.Add("Tên đối tượng");
             * da = gen.GetTable("select * from AccountingObject order by AccountingObjectCode");
             * for (int i = 0; i < da.Rows.Count; i++)
             * {
             *   DataRow dr = temp4.NewRow();
             *   dr[0] = da.Rows[i][1].ToString();
             *   dr[1] = da.Rows[i][2].ToString();
             *   temp4.Rows.Add(dr);
             * }
             * ledt.Properties.DataSource = temp4;
             * ledt.Properties.DisplayMember = "Mã đối tượng";
             * ledt.Properties.ValueMember = "Mã đối tượng";
             * ledt.Properties.PopupWidth = 400;*/
            DataTable temp4 = new DataTable();

            temp4.Columns.Add("Mã đối tượng");
            temp4.Columns.Add("Tên đối tượng");
            for (int i = 0; i < khach.Rows.Count; i++)
            {
                DataRow dr = temp4.NewRow();
                dr[0] = khach.Rows[i][1].ToString();
                dr[1] = khach.Rows[i][2].ToString();
                temp4.Rows.Add(dr);
            }
            ledt.Properties.DataSource    = temp4;
            ledt.Properties.DisplayMember = "Mã đối tượng";
            ledt.Properties.ValueMember   = "Mã đối tượng";
            ledt.Properties.PopupWidth    = 400;

            dt.Columns.Add("Mã hàng", Type.GetType("System.String"));
            dt.Columns.Add("Tên hàng", Type.GetType("System.String"));
            dt.Columns.Add("Số lượng", Type.GetType("System.Double"));
            dt.Columns.Add("Số lượng quy đổi", Type.GetType("System.Double"));
            dt.Columns.Add("Đơn giá", Type.GetType("System.Double"));
            dt.Columns.Add("Đơn giá phí", Type.GetType("System.Double"));
            dt.Columns.Add("Thành tiền", Type.GetType("System.Double"));
            gridControl1.DataSource = dt;

            gridView1.Columns["Số lượng"].ColumnEdit         = soluong;
            gridView1.Columns["Đơn giá phí"].ColumnEdit      = chiphi;
            gridView1.Columns["Số lượng quy đổi"].ColumnEdit = soluongqd;
            gridView1.Columns["Đơn giá"].ColumnEdit          = dongia;
            gridView1.Columns["Thành tiền"].ColumnEdit       = thanhtien;
            gridView1.Columns["Thành tiền"].Width            = 200;

            gridView1.Columns["Số lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Số lượng"].DisplayFormat.FormatString = "{0:n0}";
            gridView1.Columns["Số lượng"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Số lượng"].SummaryItem.DisplayFormat  = "{0:n0}";

            gridView1.Columns["Số lượng quy đổi"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Số lượng quy đổi"].DisplayFormat.FormatString = "{0:n2}";
            gridView1.Columns["Số lượng quy đổi"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Số lượng quy đổi"].SummaryItem.DisplayFormat  = "{0:n2}";

            gridView1.Columns["Đơn giá"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Đơn giá"].DisplayFormat.FormatString = "{0:n2}";
            gridView1.Columns["Đơn giá"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Đơn giá"].SummaryItem.DisplayFormat  = "{0:n2}";

            gridView1.Columns["Thành tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Thành tiền"].DisplayFormat.FormatString = "{0:n0}";
            gridView1.Columns["Thành tiền"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Thành tiền"].SummaryItem.DisplayFormat  = "{0:n0}";

            gridView1.Columns["Đơn giá phí"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Đơn giá phí"].DisplayFormat.FormatString = "{0:n2}";
            gridView1.Columns["Đơn giá phí"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Đơn giá phí"].SummaryItem.DisplayFormat  = "{0:n2}";

            gridView1.Columns[0].SummaryItem.SummaryType          = DevExpress.Data.SummaryItemType.Count;
            gridView1.Columns[0].SummaryItem.DisplayFormat        = "Số dòng = {0}";
            gridView1.Columns["Mã hàng"].OptionsColumn.AllowEdit  = false;
            gridView1.Columns["Tên hàng"].OptionsColumn.AllowEdit = false;

            gridView1.Columns[5].Visible = false;
        }
示例#10
0
        public void loadpck(string active, string role, DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, TextEdit txtsct, LookUpEdit ledvn, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, Frm_chuyenkhonb F, LookUpEdit ledt, TextEdit txtldn,
                            ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, string userid, string branchid, TextEdit txtngh, TextEdit txtptvc, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, TextEdit txtpnv, TextEdit txtcth, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit chiphi, TextEdit txtnhd, TextEdit txtms, TextEdit txtkhhd, TextEdit txtshd, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, string tsbt, DataTable khach, DataTable hang, CheckEdit nhan)
        {
            DataTable dt = new DataTable();

            loadstart(gridControl1, gridView1, ledvn, ledv, ledt, denct, denht, mahang, soluong, soluongqd, tsbtsua, tsbtxoa, tsbtcat, tsbtboghi, tsbtghiso, tsbtnap, tsbtin, ngaychungtu, userid, branchid, active, dt, dongia, thanhtien, chiphi, txtnhd, khach, hang);
            if (active == "1")
            {
                DataTable da = new DataTable();
                da = gen.GetTable("select  InventoryItemCode,Quantity,Description,InventoryItemName,a.UnitPrice,a.Amount from INTransferBranchSUDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + role + "' order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = da.Rows[i][0].ToString();
                    dr[1] = da.Rows[i][3].ToString();
                    dr[2] = da.Rows[i][1].ToString();
                    dr[3] = da.Rows[i][4].ToString();
                    dr[4] = da.Rows[i][5].ToString();
                    dr[5] = da.Rows[i][2].ToString();
                    dt.Rows.Add(dr);
                }
                gridControl1.DataSource = dt;

                tsbtcat.Enabled = false;

                F.Text = "Xem phiếu xuất hàng gửi bán vỏ LPG";

                da = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,InvSeries,RefDate,PostedDate,RefNo,OutwardStockID,Posted,InvNo,Cancel,ShippingNo,RefNoIn,InwardStockID,No,InvDate,PostVersion  from INTransferBranchSU a, AccountingObject b where a.AccountingObjectID=b.AccountingObjectID  and RefID='" + role + "'");

                string kho  = gen.GetString("select StockCode from Stock where StockID='" + da.Rows[0][7].ToString() + "'");
                string khon = gen.GetString("select StockCode from Stock where StockID='" + da.Rows[0][13].ToString() + "'");
                ledvn.EditValue = khon;
                ledv.EditValue  = kho;
                ledt.EditValue  = da.Rows[0][0].ToString();
                txtldn.Text     = da.Rows[0][2].ToString();

                txtshd.Text      = da.Rows[0][9].ToString();
                txtkhhd.Text     = da.Rows[0][3].ToString();
                txtms.Text       = da.Rows[0][14].ToString();
                txtnhd.EditValue = DateTime.Parse(da.Rows[0][15].ToString());

                denct.EditValue = DateTime.Parse(da.Rows[0][4].ToString());
                denht.EditValue = DateTime.Parse(da.Rows[0][5].ToString());
                txtsct.Text     = da.Rows[0][6].ToString();
                txtpnv.Text     = da.Rows[0][12].ToString();
                txtngh.Text     = da.Rows[0][1].ToString();
                txtptvc.Text    = da.Rows[0][11].ToString();
                if (da.Rows[0][8].ToString() == "True")
                {
                    tsbtghiso.Visible = false;
                    tsbtboghi.Visible = true;
                    tsbtsua.Enabled   = false;
                    nhan.Enabled      = false;
                }
                else
                {
                    tsbtboghi.Visible = false;
                    tsbtghiso.Visible = true;
                }
                if (da.Rows[0][10].ToString() == "True")
                {
                    tsbtboghi.Enabled = false;
                    tsbtghiso.Enabled = false;
                }

                if (da.Rows[0][16].ToString() == "1")
                {
                    nhan.Checked = true;
                }
                else
                {
                    nhan.Checked = false;
                }

                Double tongthanhtien = Double.Parse(gridView1.Columns["Thành tiền"].SummaryText);
                txtcth.Text = String.Format("{0:n0}", tongthanhtien);
                if (tsbt == "tsbtpnhgbvlpg")
                {
                    checktruocsaunhap(tsbttruoc, tsbtsau, ledvn.EditValue.ToString(), txtpnv.Text, ngaychungtu);
                }
                else
                {
                    checktruocsau(tsbttruoc, tsbtsau, ledv.EditValue.ToString(), txtsct.Text, ngaychungtu);
                }
            }
            else
            {
                F.Text = "Thêm phiếu xuất hàng gửi bán vỏ LPG";
                if (role == null)
                {
                    ledv.ItemIndex = 0;
                }
                else
                {
                    ledv.EditValue = role;
                }
                denht.EditValue  = DateTime.Parse(ngaychungtu);
                txtnhd.EditValue = DateTime.Parse(ngaychungtu);
                denct.EditValue  = DateTime.Parse(ngaychungtu);
                nhan.Checked     = false;
            }
        }
示例#11
0
        public void loadstart(DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, LookUpEdit ledvn, LookUpEdit ledv, LookUpEdit ledt, DateEdit denct, DateEdit denht,
                              DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat,
                              ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, string userid, string branchid, string active, DataTable dt, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit chiphi, TextEdit txtnhd, DataTable khach, DataTable hang)
        {
            DataTable da    = new DataTable();
            DataTable temp  = new DataTable();
            DataTable temp1 = new DataTable();
            DataTable temp2 = new DataTable();

            temp1.Columns.Add("Mã kho");
            temp1.Columns.Add("Tên kho");
            da = gen.GetTable("select * from Stock order by StockCode");
            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dr = temp1.NewRow();
                dr[0] = da.Rows[i][1].ToString();
                dr[1] = da.Rows[i][2].ToString();
                temp1.Rows.Add(dr);
            }
            ledvn.Properties.DataSource    = temp1;
            ledvn.Properties.DisplayMember = "Mã kho";
            ledvn.Properties.ValueMember   = "Mã kho";
            ledvn.ItemIndex = 0;

            temp.Columns.Add("Mã kho");
            temp.Columns.Add("Tên kho");
            da = gen.GetTable("select * from Stock where StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') order by StockCode");
            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dr = temp.NewRow();
                dr[0] = da.Rows[i][1].ToString();
                dr[1] = da.Rows[i][2].ToString();
                temp.Rows.Add(dr);
            }
            ledv.Properties.DataSource    = temp;
            ledv.Properties.DisplayMember = "Mã kho";
            ledv.Properties.ValueMember   = "Mã kho";
            ledv.Properties.PopupWidth    = 300;

            /*temp2.Columns.Add("Mã đối tượng");
             * temp2.Columns.Add("Tên đối tượng");
             * da = gen.GetTable("select * from AccountingObject where IsEmployee='True' order by AccountingObjectCode");
             * for (int i = 0; i < da.Rows.Count; i++)
             * {
             *  DataRow dr = temp2.NewRow();
             *  dr[0] = da.Rows[i][1].ToString();
             *  dr[1] = da.Rows[i][2].ToString();
             *  temp2.Rows.Add(dr);
             * }
             * ledt.Properties.DataSource = temp2;
             * ledt.Properties.DisplayMember = "Mã đối tượng";
             * ledt.Properties.ValueMember = "Mã đối tượng";
             * ledt.Properties.PopupWidth = 400;*/
            temp2.Columns.Add("Mã đối tượng");
            temp2.Columns.Add("Tên đối tượng");
            for (int i = 0; i < khach.Rows.Count; i++)
            {
                DataRow dr = temp2.NewRow();
                dr[0] = khach.Rows[i][1].ToString();
                dr[1] = khach.Rows[i][2].ToString();
                temp2.Rows.Add(dr);
            }
            ledt.Properties.DataSource    = temp2;
            ledt.Properties.DisplayMember = "Mã đối tượng";
            ledt.Properties.ValueMember   = "Mã đối tượng";
            ledt.Properties.PopupWidth    = 400;

            /*da = gen.GetTable("select InventoryItemCode,InventoryItemName from InventoryItem where Parent is not Null order by InventoryItemCode");
             * DataTable temp3 = new DataTable();
             * temp3.Columns.Add("Mã hàng");
             * temp3.Columns.Add("Tên hàng");
             * for (int i = 0; i < da.Rows.Count; i++)
             * {
             *  DataRow dr = temp3.NewRow();
             *  dr[0] = da.Rows[i][0].ToString();
             *  dr[1] = da.Rows[i][1].ToString();
             *  temp3.Rows.Add(dr);
             * }
             * mahang.DataSource = temp3;
             * mahang.DisplayMember = "Mã hàng";
             * mahang.ValueMember = "Mã hàng";*/
            DataTable temp3 = new DataTable();

            temp3.Columns.Add("Mã hàng");
            temp3.Columns.Add("Tên hàng");
            for (int i = 0; i < hang.Rows.Count; i++)
            {
                DataRow dr = temp3.NewRow();
                dr[0] = hang.Rows[i][1].ToString();
                dr[1] = hang.Rows[i][2].ToString();
                temp3.Rows.Add(dr);
            }
            mahang.DataSource    = temp3;
            mahang.DisplayMember = "Mã hàng";
            mahang.ValueMember   = "Mã hàng";

            dt.Columns.Add("Mã hàng", Type.GetType("System.String"));
            dt.Columns.Add("Tên hàng");
            dt.Columns.Add("Số lượng", Type.GetType("System.Double"));
            dt.Columns.Add("Đơn giá", Type.GetType("System.Double"));
            dt.Columns.Add("Thành tiền", Type.GetType("System.Double"));
            dt.Columns.Add("Diễn giải");
            gridControl1.DataSource = dt;
            gridView1.Columns["Mã hàng"].ColumnEdit  = mahang;
            gridView1.Columns["Số lượng"].ColumnEdit = soluong;

            gridView1.Columns["Đơn giá"].ColumnEdit    = dongia;
            gridView1.Columns["Thành tiền"].ColumnEdit = thanhtien;

            gridView1.Columns["Diễn giải"].Width = 300;

            gridView1.Columns["Số lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Số lượng"].DisplayFormat.FormatString = "{0:n0}";

            gridView1.Columns["Số lượng"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Số lượng"].SummaryItem.DisplayFormat = "{0:n0}";

            gridView1.Columns["Đơn giá"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Đơn giá"].DisplayFormat.FormatString = "{0:n2}";
            gridView1.Columns["Đơn giá"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Đơn giá"].SummaryItem.DisplayFormat  = "{0:n2}";

            gridView1.Columns["Thành tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Thành tiền"].DisplayFormat.FormatString = "{0:n0}";
            gridView1.Columns["Thành tiền"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Thành tiền"].SummaryItem.DisplayFormat  = "{0:n0}";

            gridView1.Columns[0].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            gridView1.Columns[0].SummaryItem.DisplayFormat = "Số dòng = {0}";
        }
示例#12
0
 //save//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void checkpxht(string active, string role, Frm_phieudieuchinh F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, TextEdit txtsct, TextEdit txtname,
                       TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                       ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, string userid, string branchid, TextEdit txtms)
 {
     try
     {
         string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
         string[,] detail = new string[20, 8];
         string check = "0";
         for (int i = 0; i < gridView1.RowCount - 1; i++)
         {
             if (gridView1.GetRowCellValue(i, "Tài khoản có").ToString() == "")
             {
                 check = "1";
             }
             detail[i, 0] = gridView1.GetRowCellValue(i, "Tài khoản có").ToString();
             if (gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString() == "")
             {
                 check = "1";
             }
             detail[i, 1] = gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString();
             if (gridView1.GetRowCellValue(i, "Mã hàng").ToString() == "")
             {
                 check = "1";
             }
             else
             {
                 string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                 detail[i, 2] = mh;
             }
             if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
             {
                 detail[i, 3] = "0";
             }
             else
             {
                 detail[i, 3] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
             }
             if (gridView1.GetRowCellValue(i, "Đơn giá").ToString() == "")
             {
                 detail[i, 4] = "0";
             }
             else
             {
                 detail[i, 4] = gridView1.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "").Replace(",", ".");
             }
             if (gridView1.GetRowCellValue(i, "Thành tiền").ToString() == "")
             {
                 detail[i, 5] = "0";
             }
             else
             {
                 detail[i, 5] = gridView1.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
             }
             if (gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString() == "")
             {
                 detail[i, 6] = "0";
             }
             else
             {
                 detail[i, 6] = gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString().Replace(".", "").Replace(",", ".");
             }
         }
         if (check == "1")
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Tài khoản có> <Tài khoản nợ> <Mã hàng> <Số lượng> <Đơn giá> <Thành tiền> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             string dv   = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
             string tong = gridView1.Columns["Thành tiền"].SummaryText.Replace(".", "");
             if (active == "0")
             {
                 try
                 {
                     string ton = gen.GetString("select * from INOutwardFree where RefNo='" + txtsct.Text + "'");
                     themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), branchid);
                     XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 catch { }
                 gen.ExcuteNonquery("insert into INOutwardFree(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,JournalMemo,Posted,StockID,TotalAmount,InvSeries,InvNo,InvDate,EmployeeID,No) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtldn.Text + "','False','" + dv + "','" + tong + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + txtnhd.EditValue.ToString() + "','" + userid + "','" + txtms.Text + "')");
                 string refid = gen.GetString("select * from INOutwardFree where RefNo='" + txtsct.Text + "'");
                 F.getrole(refid);
                 for (int i = 0; i < gridView1.RowCount - 1; i++)
                 {
                     gen.ExcuteNonquery("insert into INOutwardFreeDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,QuantityConvert) values(newid(),'" + refid + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "','" + detail[i, 6] + "')");
                 }
             }
             else
             {
                 gen.ExcuteNonquery("update INOutwardFree set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',JournalMemo=N'" + txtldn.Text + "',StockID='" + dv + "',TotalAmount='" + tong + "',Posted='False',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',InvDate='" + txtnhd.EditValue.ToString() + "',EmployeeID='" + userid + "',No='" + txtms.Text + "'  where RefID='" + role + "'");
                 gen.ExcuteNonquery("delete  from  INOutwardFreeDetail where RefID='" + role + "'");
                 for (int i = 0; i < gridView1.RowCount - 1; i++)
                 {
                     gen.ExcuteNonquery("insert into INOutwardFreeDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,QuantityConvert) values(newid(),'" + role + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "','" + detail[i, 6] + "')");
                 }
             }
             F.myac();
             F.getactive("1");
             F.Text = "Xem phiếu xuất hàng khuyến mãi";
         }
     }
     catch
     {
         XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#13
0
        private Control CreateDSElement(NICSQLTools.Data.dsDataSource.AppDatasourceParamRow ParamRow, string ParamType)
        {
            object ctr = null;
            if (!ParamRow.IsLookupIDNull())
            {
                ctr = CreateLookupedit(ParamRow.LookupID);
            }
            else
            {
                switch (ParamType.ToLower())
                {
                    case "nvarchar":
                        TextEdit txt1 = new TextEdit();
                        txt1.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                        ctr = txt1;
                        break;
                    case "int":
                    case "smallint":
                    case "bigint":
                        TextEdit txt2 = new TextEdit();
                        txt2.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                        txt2.Properties.DisplayFormat.FormatString = "n0";
                        txt2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                        txt2.Properties.EditFormat.FormatString = "n0";
                        txt2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                        txt2.Properties.Mask.EditMask = "n0";
                        txt2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                        ctr = txt2;
                        break;
                    case "float":
                        TextEdit txt3 = new TextEdit();
                        txt3.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                        txt3.Properties.DisplayFormat.FormatString = "f2";
                        txt3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                        txt3.Properties.EditFormat.FormatString = "f2";
                        txt3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                        txt3.Properties.Mask.EditMask = "f2";
                        txt3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                        ctr = txt3;
                        break;
                    case "datetime":
                        DateEdit de1 = new DateEdit();
                        de1.EditValue = null;
                        de1.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                        de1.Properties.DisplayFormat.FormatString = "yyyy-MM-dd";
                        de1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                        de1.Properties.EditFormat.FormatString = "yyyy-MM-dd";
                        de1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                        de1.Properties.Mask.EditMask = "yyyy-MM-dd";
                        de1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
                        ctr = de1;
                        break;
                    default:
                        break;
                }
            }


            ((TextEdit)ctr).Properties.NullValuePrompt = ParamRow.ParamDisplayName;
            return (Control)ctr;
        }
示例#14
0
 /// <summary>
 /// 日期控件绑定
 /// </summary>
 /// <param name="tab">控件关联数据源</param>
 /// <param name="ctrl">复选框控件</param>
 /// <param name="fld">控件关联字段</param>
 private void bindctrl(DataTable tab, DateEdit ctrl, string fld)
 {
     if (null == tab || null == ctrl || string.IsNullOrEmpty(fld))
         return;
     ctrl.DataBindings.Add("Editvalue", tab, fld, true, DataSourceUpdateMode.OnPropertyChanged, false, "");
     ctrl.Click += new EventHandler(ct_ValueChanged);
 }
示例#15
0
 private void InitializeComponent()
 {
     this.components = new Container();
     XYDiagram diagram = new XYDiagram();
     Series series = new Series();
     LineSeriesView view = new LineSeriesView();
     LineSeriesView view2 = new LineSeriesView();
     this.gpgChart = new GPGChartControl(this.components);
     this.btnCalculate = new GPGButton();
     this.tbMinutes = new GPGTextBox();
     this.gpgLabel2 = new GPGLabel();
     this.lStatus = new GPGLabel();
     this.deDate = new DateEdit();
     ((ISupportInitialize) this.gpgChart).BeginInit();
     ((ISupportInitialize) diagram).BeginInit();
     ((ISupportInitialize) series).BeginInit();
     ((ISupportInitialize) view).BeginInit();
     ((ISupportInitialize) view2).BeginInit();
     this.tbMinutes.Properties.BeginInit();
     this.deDate.Properties.BeginInit();
     base.SuspendLayout();
     base.ttDefault.DefaultController.AutoPopDelay = 0x3e8;
     this.gpgChart.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
     this.gpgChart.AppearanceName = "Northern Lights";
     diagram.AxisX.Tickmarks.MinorVisible = false;
     diagram.AxisX.GridLines.Visible = true;
     diagram.AxisX.GridSpacingAuto = false;
     diagram.AxisX.Label.Angle = 90;
     diagram.AxisX.Label.Visible = false;
     diagram.AxisX.Title.Visible = true;
     diagram.AxisX.Title.Text = "User Connections";
     diagram.AxisX.GridSpacing = 0.01;
     diagram.AxisX.MinorCount = 1;
     diagram.AxisX.Interlaced = true;
     this.gpgChart.Diagram = diagram;
     this.gpgChart.Legend.Visible = false;
     this.gpgChart.Location = new Point(0x13, 0x65);
     this.gpgChart.Name = "gpgChart";
     series.PointOptionsTypeName = "PointOptions";
     series.View = view;
     series.Name = "Logins";
     this.gpgChart.Series.AddRange(new Series[] { series });
     this.gpgChart.SeriesTemplate.PointOptionsTypeName = "PointOptions";
     this.gpgChart.SeriesTemplate.View = view2;
     this.gpgChart.Size = new Size(0x256, 0x120);
     this.gpgChart.TabIndex = 7;
     this.btnCalculate.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
     this.btnCalculate.Location = new Point(0x1ee, 0x18b);
     this.btnCalculate.LookAndFeel.SkinName = "London Liquid Sky";
     this.btnCalculate.LookAndFeel.UseDefaultLookAndFeel = false;
     this.btnCalculate.Name = "btnCalculate";
     this.btnCalculate.Size = new Size(0x7f, 0x17);
     this.btnCalculate.TabIndex = 8;
     this.btnCalculate.Text = "<LOC>Calculate Stats";
     this.btnCalculate.UseVisualStyleBackColor = false;
     this.btnCalculate.Click += new EventHandler(this.btnCalculate_Click);
     this.tbMinutes.EditValue = "60";
     this.tbMinutes.Location = new Point(0x6c, 0x4b);
     this.tbMinutes.Name = "tbMinutes";
     this.tbMinutes.Properties.Appearance.BackColor = Color.Black;
     this.tbMinutes.Properties.Appearance.BorderColor = Color.FromArgb(0x52, 0x83, 190);
     this.tbMinutes.Properties.Appearance.ForeColor = Color.White;
     this.tbMinutes.Properties.Appearance.Options.UseBackColor = true;
     this.tbMinutes.Properties.Appearance.Options.UseBorderColor = true;
     this.tbMinutes.Properties.Appearance.Options.UseForeColor = true;
     this.tbMinutes.Properties.AppearanceFocused.BackColor = Color.FromArgb(0x10, 0x21, 0x4f);
     this.tbMinutes.Properties.AppearanceFocused.BackColor2 = Color.FromArgb(0, 0, 0);
     this.tbMinutes.Properties.AppearanceFocused.BorderColor = Color.FromArgb(0xbb, 0xc9, 0xe2);
     this.tbMinutes.Properties.AppearanceFocused.GradientMode = LinearGradientMode.ForwardDiagonal;
     this.tbMinutes.Properties.AppearanceFocused.Options.UseBackColor = true;
     this.tbMinutes.Properties.AppearanceFocused.Options.UseBorderColor = true;
     this.tbMinutes.Properties.BorderStyle = BorderStyles.Simple;
     this.tbMinutes.Properties.DisplayFormat.FormatType = FormatType.Numeric;
     this.tbMinutes.Properties.EditFormat.FormatType = FormatType.Numeric;
     this.tbMinutes.Properties.LookAndFeel.SkinName = "London Liquid Sky";
     this.tbMinutes.Properties.LookAndFeel.UseDefaultLookAndFeel = false;
     this.tbMinutes.Size = new Size(100, 20);
     this.tbMinutes.TabIndex = 10;
     this.gpgLabel2.AutoSize = true;
     this.gpgLabel2.AutoStyle = true;
     this.gpgLabel2.Font = new Font("Arial", 9.75f);
     this.gpgLabel2.ForeColor = Color.White;
     this.gpgLabel2.IgnoreMouseWheel = false;
     this.gpgLabel2.IsStyled = false;
     this.gpgLabel2.Location = new Point(20, 0x4c);
     this.gpgLabel2.Name = "gpgLabel2";
     this.gpgLabel2.Size = new Size(0x52, 0x10);
     this.gpgLabel2.TabIndex = 12;
     this.gpgLabel2.Text = "Minute Ticks";
     this.gpgLabel2.TextStyle = TextStyles.Default;
     this.lStatus.AutoSize = true;
     this.lStatus.AutoStyle = true;
     this.lStatus.Font = new Font("Arial", 9.75f);
     this.lStatus.ForeColor = Color.White;
     this.lStatus.IgnoreMouseWheel = false;
     this.lStatus.IsStyled = false;
     this.lStatus.Location = new Point(0x16b, 0x4f);
     this.lStatus.Name = "lStatus";
     this.lStatus.Size = new Size(0x43, 0x10);
     this.lStatus.TabIndex = 13;
     this.lStatus.Text = "gpgLabel1";
     this.lStatus.TextStyle = TextStyles.Default;
     this.lStatus.Visible = false;
     this.deDate.EditValue = null;
     this.deDate.Location = new Point(0xd6, 0x4b);
     this.deDate.Name = "deDate";
     this.deDate.Properties.Appearance.BackColor = Color.Black;
     this.deDate.Properties.Appearance.ForeColor = Color.White;
     this.deDate.Properties.Appearance.Options.UseBackColor = true;
     this.deDate.Properties.Appearance.Options.UseForeColor = true;
     this.deDate.Properties.BorderStyle = BorderStyles.Simple;
     this.deDate.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
     this.deDate.Size = new Size(0x8f, 20);
     this.deDate.TabIndex = 14;
     base.AutoScaleDimensions = new SizeF(7f, 13f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.ClientSize = new Size(640, 480);
     base.Controls.Add(this.deDate);
     base.Controls.Add(this.lStatus);
     base.Controls.Add(this.gpgLabel2);
     base.Controls.Add(this.tbMinutes);
     base.Controls.Add(this.btnCalculate);
     base.Controls.Add(this.gpgChart);
     base.Location = new Point(0, 0);
     base.Name = "DlgConnectionsGraph";
     this.Text = "DlgConnectionsGraph";
     base.Controls.SetChildIndex(this.gpgChart, 0);
     base.Controls.SetChildIndex(this.btnCalculate, 0);
     base.Controls.SetChildIndex(this.tbMinutes, 0);
     base.Controls.SetChildIndex(this.gpgLabel2, 0);
     base.Controls.SetChildIndex(this.lStatus, 0);
     base.Controls.SetChildIndex(this.deDate, 0);
     ((ISupportInitialize) diagram).EndInit();
     ((ISupportInitialize) view).EndInit();
     ((ISupportInitialize) series).EndInit();
     ((ISupportInitialize) view2).EndInit();
     ((ISupportInitialize) this.gpgChart).EndInit();
     this.tbMinutes.Properties.EndInit();
     this.deDate.Properties.EndInit();
     base.ResumeLayout(false);
     base.PerformLayout();
 }
示例#16
0
 public CustomDateEditStrategy(DateEdit editor)
     : base(editor)
 {
 }
示例#17
0
        public void loadpnk(string active, string role, DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, TextEdit txtsct, ComboBoxEdit cbldt, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, Frm_phieunhapgas F, LookUpEdit ledt, TextEdit txtldn, TextEdit txtctg,
                            ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripSplitButton tsbtin, string ngaychungtu, string userid, string branchid, TextEdit txtngh, TextEdit txtptvc, DevExpress.XtraGrid.GridControl gridControl2, GridView gridView2, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, TextEdit txtpnv, LookUpEdit lenv, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau)
        {
            DataTable dt  = new DataTable();
            DataTable dt1 = new DataTable();

            loadstart(gridControl1, gridView1, cbldt, ledv, denct, denht, mahang, soluong, soluongqd, ledt, tsbtsua, tsbtxoa, tsbtcat, tsbtboghi, tsbtghiso, tsbtnap, tsbtin, ngaychungtu, userid, branchid, active, dt, dt1, gridControl2, gridView2, dongia, thanhtien, lenv);
            if (active == "1")
            {
                DataTable da = new DataTable();
                da = gen.GetTable("select  InventoryItemCode,Quantity,QuantityConvert,Description,InventoryItemName from INInwardDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + role + "' order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = da.Rows[i][0].ToString();
                    dr[1] = da.Rows[i][4].ToString();
                    dr[2] = da.Rows[i][1].ToString();
                    dr[3] = da.Rows[i][2].ToString();
                    dr[4] = da.Rows[i][3].ToString();
                    dt.Rows.Add(dr);
                }
                gridControl1.DataSource = dt;

                da = gen.GetTable("select  InventoryItemCode,Quantity,QuantityConvert,Description,InventoryItemName,a.UnitPrice,a.Amount from INInwardSUDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID in (select refSUID from INInward where refID='" + role + "') order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    DataRow dr = dt1.NewRow();
                    dr[0] = da.Rows[i][0].ToString();
                    dr[1] = da.Rows[i][4].ToString();
                    dr[2] = da.Rows[i][1].ToString();
                    dr[3] = da.Rows[i][5].ToString();
                    dr[4] = da.Rows[i][6].ToString();
                    dr[5] = da.Rows[i][3].ToString();
                    dt1.Rows.Add(dr);
                }
                gridControl2.DataSource = dt1;

                tsbtcat.Enabled = false;

                F.Text = "Xem phiếu nhập kho Gas";
                da     = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,ShippingNo,EmployeeIDPU  from INInward a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + role + "'");
                string No = gen.GetString("select a.refNo from INInwardSU a, INInward b where b.RefID='" + role + "' and a.RefID=b.refSUID");
                try
                {
                    cbldt.SelectedIndex = Int32.Parse(da.Rows[0][9].ToString());
                }
                catch { }
                ledv.EditValue = da.Rows[0][7].ToString();
                ledt.EditValue = da.Rows[0][0].ToString();
                try
                {
                    txtldn.Text = da.Rows[0][2].ToString();
                }
                catch { }
                txtctg.Text     = da.Rows[0][3].ToString();
                denct.EditValue = DateTime.Parse(da.Rows[0][4].ToString());
                denht.EditValue = DateTime.Parse(da.Rows[0][5].ToString());
                txtsct.Text     = da.Rows[0][6].ToString();
                txtpnv.Text     = No;
                txtngh.Text     = da.Rows[0][1].ToString();
                txtptvc.Text    = da.Rows[0][11].ToString();
                if (da.Rows[0][8].ToString() == "True")
                {
                    tsbtghiso.Visible = false;
                    tsbtboghi.Visible = true;
                    tsbtsua.Enabled   = false;
                }
                else
                {
                    tsbtboghi.Visible = false;
                    tsbtghiso.Visible = true;
                }
                if (da.Rows[0][10].ToString() == "True")
                {
                    tsbtboghi.Enabled = false;
                    tsbtghiso.Enabled = false;
                }

                try
                {
                    string nv = gen.GetString("select AccountingObjectCode from AccountingObject where AccountingObjectID='" + da.Rows[0][12].ToString() + "'");
                    lenv.EditValue = nv;
                }
                catch
                {
                    lenv.EditValue = "3";
                }
                checktruocsau(tsbttruoc, tsbtsau, ledv.EditValue.ToString(), txtsct.Text, ngaychungtu);
            }
            else
            {
                F.Text = "Thêm phiếu nhập kho LPG";
                if (role == null)
                {
                    ledv.ItemIndex = 0;
                }
                else
                {
                    ledv.EditValue = role;
                }
                denht.EditValue = DateTime.Parse(ngaychungtu);
                denct.EditValue = DateTime.Parse(ngaychungtu);
            }
        }
示例#18
0
        public void checkpck(string active, string role, Frm_chuyenkhonb F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, LookUpEdit ledvn, TextEdit txtsct, TextEdit txtname, TextEdit txtngh, TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                             ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, TextEdit txtptvc, string userid, string branchid, TextEdit txtpnv, TextEdit txtms, TextEdit txtkhhd, TextEdit txtshd, TextEdit txtnhd, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, string bat)
        {
            try
            {
                string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
                string[,] detail = new string[20, 8];
                string check = "0";
                for (int i = 0; i < gridView1.RowCount - 1; i++)
                {
                    if (gridView1.GetRowCellValue(i, "Mã hàng").ToString() == "")
                    {
                        check = "1";
                    }
                    else
                    {
                        string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                        detail[i, 0] = mh;
                    }
                    if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
                    {
                        detail[i, 1] = "0";
                    }
                    else
                    {
                        detail[i, 1] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                    }
                    detail[i, 2] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                    if (gridView1.GetRowCellValue(i, "Đơn giá").ToString() == "")
                    {
                        detail[i, 4] = "0";
                    }
                    else
                    {
                        detail[i, 4] = gridView1.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "").Replace(",", ".");
                    }
                    if (gridView1.GetRowCellValue(i, "Thành tiền").ToString() == "")
                    {
                        detail[i, 5] = "0";
                    }
                    else
                    {
                        detail[i, 5] = gridView1.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
                    }
                    detail[i, 3] = gridView1.GetRowCellValue(i, "Diễn giải").ToString();
                }

                if (check == "1")
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Mã hàng> <Số lượng quy đổi> <Đơn giá> <Thành tiền> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string dv       = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                    string dvn      = gen.GetString("select * from Stock where StockCode='" + ledvn.EditValue.ToString() + "'");
                    string tongtien = gridView1.Columns["Thành tiền"].SummaryText.Replace(".", "");
                    if (active == "0")
                    {
                        try
                        {
                            string ton = gen.GetString("select * from INTransferBranchSU where RefNo='" + txtsct.Text + "'");
                            themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), tsbttruoc, tsbtsau);
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }

                        try
                        {
                            string ton = gen.GetString("select * from INTransferBranchSU where RefNoIn='" + txtpnv.Text + "'");
                            themsctn(ngaychungtu, txtpnv, ledvn.EditValue.ToString());
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }

                        gen.ExcuteNonquery("insert into INTransferBranchSU(RefID,RefType,RefDate,PostedDate,RefNo,RefNoIn,AccountingObjectID,AccountingObjectName,Contactname,JournalMemo,Posted,OutwardStockID,InwardStockID,ShippingNo,TotalAmount,No,InvSeries,InvNo,InvDate) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + txtpnv.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtngh.Text + "',N'" + txtldn.Text + "','False','" + dv + "','" + dvn + "','" + txtptvc.Text + "','" + tongtien + "','" + txtms.Text + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + txtnhd.EditValue.ToString() + "')");
                        string refid = gen.GetString("select * from INTransferBranchSU where RefNo='" + txtsct.Text + "'");
                        F.getrole(refid);
                        if (DateTime.Parse(ngaychungtu) < DateTime.Parse("09/01/2017"))
                        {
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + refid + "','" + txtsct.Text + "','336','1563','" + tongtien + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + refid + "','" + txtpnv.Text + "','1563','336','" + tongtien + "','" + dt + "','" + dvn + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");
                        }
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into INTransferBranchSUDetail(RefDetailID,RefID,Quantity,QuantityConvert,SortOrder,InventoryItemID,Description,UnitPrice,Amount) values(newid(),'" + refid + "','" + detail[i, 1] + "','" + detail[i, 2] + "'," + i + ",'" + detail[i, 0] + "',N'" + detail[i, 3] + "','" + detail[i, 4] + "','" + detail[i, 5] + "')");
                        }
                    }
                    else
                    {
                        if (bat == "1")
                        {
                            try
                            {
                                string ton = gen.GetString("select * from INTransferBranchSU where RefNoIn='" + txtpnv.Text + "'");
                                themsctn(ngaychungtu, txtpnv, ledvn.EditValue.ToString());
                                XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            catch { }
                        }
                        gen.ExcuteNonquery("update INTransferBranchSU set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',Contactname=N'" + txtngh.Text + "',JournalMemo=N'" + txtldn.Text + "',RefNoIn='" + txtpnv.Text + "',InwardStockID='" + dvn + "',Posted='False',ShippingNo='" + txtptvc.Text + "',TotalAmount='" + tongtien + "',No='" + txtms.Text + "',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',InvDate='" + txtnhd.EditValue.ToString() + "'  where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete  from  INTransferBranchSUDetail where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete HACHTOAN where RefID='" + role + "'");
                        if (DateTime.Parse(ngaychungtu) < DateTime.Parse("09/01/2017"))
                        {
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + role + "','" + txtsct.Text + "','336','1563','" + tongtien + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + role + "','" + txtpnv.Text + "','1563','336','" + tongtien + "','" + dt + "','" + dvn + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");
                        }
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into INTransferBranchSUDetail(RefDetailID,RefID,Quantity,QuantityConvert,SortOrder,InventoryItemID,Description,UnitPrice,Amount) values(newid(),'" + role + "','" + detail[i, 1] + "','" + detail[i, 2] + "'," + i + ",'" + detail[i, 0] + "',N'" + detail[i, 3] + "','" + detail[i, 4] + "','" + detail[i, 5] + "')");
                        }
                    }
                    F.myac();
                    F.getactive("1");
                    F.Text = "Xem phiếu xuất hàng gửi bán vỏ LPG";
                }
            }
            catch
            {
                XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#19
0
        //save//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void checkpndc(string active, string role, Frm_phieunhaphangbantralai F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, TextEdit txtsct, TextEdit txtname,
                              TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                              ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, string userid, string branchid, TextEdit txtms, ComboBoxEdit cbthue, CheckEdit ckhd, string hoadon, TextEdit txtthue, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau)
        {
            try
            {
                string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
                string[,] detail = new string[20, 8];

                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    if (gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString() != "")
                    {
                        detail[i, 0] = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                        if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
                        {
                            detail[i, 1] = "0";
                        }
                        else
                        {
                            detail[i, 1] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                        }
                        if (gridView1.GetRowCellValue(i, "Đơn giá").ToString() == "")
                        {
                            detail[i, 2] = "0";
                        }
                        else
                        {
                            detail[i, 2] = gridView1.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "").Replace(",", ".");
                        }
                        if (gridView1.GetRowCellValue(i, "Đơn giá phí").ToString() == "")
                        {
                            detail[i, 3] = "0";
                        }
                        else
                        {
                            detail[i, 3] = gridView1.GetRowCellValue(i, "Đơn giá phí").ToString().Replace(".", "").Replace(",", ".");
                        }
                        if (gridView1.GetRowCellValue(i, "Thành tiền").ToString() == "")
                        {
                            detail[i, 4] = "0";
                        }
                        else
                        {
                            detail[i, 4] = gridView1.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
                        }
                        if (gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString() == "")
                        {
                            detail[i, 5] = "0";
                        }
                        else
                        {
                            detail[i, 5] = gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString().Replace(".", "").Replace(",", ".");
                        }
                    }
                }

                string dv   = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                string tong = gridView1.Columns["Thành tiền"].SummaryText.Replace(".", "");
                if (active == "0")
                {
                    try
                    {
                        string ton = gen.GetString("select * from INReInward where RefNo='" + txtsct.Text + "'");
                        themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), branchid, tsbttruoc, tsbtsau);
                        XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch { }
                    gen.ExcuteNonquery("insert into INReInward(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,JournalMemo,Posted,StockID,TotalAmount,InvSeries,InvNo,InvDate,EmployeeID,No,Tax,CheckIn,RefIn,TotalVATAmount) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtldn.Text + "','False','" + dv + "','" + tong + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + txtnhd.EditValue.ToString() + "','" + userid + "','" + txtms.Text + "','" + cbthue.EditValue.ToString() + "','" + ckhd.Checked.ToString() + "','" + hoadon + "','" + txtthue.Text.Replace(".", "") + "')");
                    string refid = gen.GetString("select * from INReInward where RefNo='" + txtsct.Text + "'");
                    gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + refid + "','" + txtsct.Text + "','1561','632','" + tong + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");

                    /*gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate) values(newid(),'" + refid + "','" + txtsct.Text + "','531','131','" + tong + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "')");
                     * gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate) values(newid(),'" + refid + "','" + txtsct.Text + "','33311','131','" + txtthue.Text.Replace(".", "") + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "')");*/
                    F.getrole(refid);
                    if (ckhd.Checked == true)
                    {
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            try
                            {
                                gen.ExcuteNonquery("insert into INReInwardDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,UnitPriceCost,QuantityConvert) values(newid(),'" + refid + "',1561,632,'" + detail[i, 4] + "','" + detail[i, 1] + "'," + i + ",'" + detail[i, 0] + "','" + detail[i, 2] + "','" + detail[i, 3] + "','" + detail[i, 5] + "')");
                            }
                            catch { }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            try
                            {
                                gen.ExcuteNonquery("insert into INReInwardDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,UnitPriceCost,QuantityConvert,DebitAccountIn,CreditAccountIn) values(newid(),'" + refid + "',1561,632,'" + detail[i, 4] + "','" + detail[i, 1] + "'," + i + ",'" + detail[i, 0] + "','" + detail[i, 2] + "','" + detail[i, 3] + "','" + detail[i, 5] + "',531,632)");
                            }
                            catch {}
                        }
                    }
                }
                else
                {
                    gen.ExcuteNonquery("update INReInward set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',JournalMemo=N'" + txtldn.Text + "',StockID='" + dv + "',TotalAmount='" + tong + "',Posted='False',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',InvDate='" + txtnhd.EditValue.ToString() + "',EmployeeID='" + userid + "',No='" + txtms.Text + "',Tax='" + cbthue.EditValue.ToString() + "',CheckIn='" + ckhd.Checked.ToString() + "',RefIn='" + hoadon + "',TotalVATAmount='" + txtthue.Text.Replace(".", "") + "'  where RefID='" + role + "'");
                    gen.ExcuteNonquery("delete  from  INReInwardDetail where RefID='" + role + "'");
                    gen.ExcuteNonquery("delete HACHTOAN where RefID='" + role + "'");
                    gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + role + "','" + txtsct.Text + "','156','632','" + tong + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");

                    /*gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate) values(newid(),'" + role + "','" + txtsct.Text + "','531','131','" + tong + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "')");
                     * gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate) values(newid(),'" + role + "','" + txtsct.Text + "','33311','131','" + txtthue.Text.Replace(".", "") + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "')");*/
                    if (ckhd.Checked == true)
                    {
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            try
                            {
                                gen.ExcuteNonquery("insert into INReInwardDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,UnitPriceCost,QuantityConvert) values(newid(),'" + role + "',1561,632,'" + detail[i, 4] + "','" + detail[i, 1] + "'," + i + ",'" + detail[i, 0] + "','" + detail[i, 2] + "','" + detail[i, 3] + "','" + detail[i, 5] + "')");
                            }
                            catch { }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < gridView1.RowCount; i++)
                        {
                            try
                            {
                                gen.ExcuteNonquery("insert into INReInwardDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,UnitPrice,UnitPriceCost,QuantityConvert,DebitAccountIn,CreditAccountIn) values(newid(),'" + role + "',1561,632,'" + detail[i, 4] + "','" + detail[i, 1] + "'," + i + ",'" + detail[i, 0] + "','" + detail[i, 2] + "','" + detail[i, 3] + "','" + detail[i, 5] + "',531,632)");
                            }
                            catch { }
                        }
                    }
                }
                F.myac();
                F.getactive("1");
                F.Text = "Xem phiếu nhập hàng bán trả lại";
            }
            catch
            {
                XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#20
0
 public CustomVistaPopupDateEditForm(DateEdit ownerEdit) : base(ownerEdit)
 {
 }
示例#21
0
        private void grvExportList_Click(object sender, EventArgs e)
        {
            xbeFileName.Text = "";
            this.xpbProcecess.Position = 0;
            try
            {

                int height = 0;
                strSPName = grvExportList.GetDataRow(grvExportList.GetSelectedRows()[0])["ProcedureName"].ToString();
                //Generalte Filter Condition
                grbFilter.Controls.Clear();
                DataTable dtParameter = GetParameter(strSPName);
                if ((dtParameter != null) && (dtParameter.Rows.Count <= 0))
                    grbFilter.Visible = false;
                else
                {
                    cellLocation = new string[3, dtParameter.Rows.Count];// frist used for Name, second used for Location and third used for Value
                    int index = 0;
                    grbFilter.Visible = true;
                    grbFilter.Height = 30;
                    //generate filter condition
                    foreach (DataRow dr in dtParameter.Rows)
                    {
                        //cut lose @LoginID
                        if (dr[P_NAME].ToString().ToLower().Equals(CommonConst.A_LoginID.ToLower()))
                            continue;
                        height += 25;
                        grbFilter.Height += 25;
                        // set lable
                        Label lbl = new Label();
                        lbl.Name = LBL_PREFIX + dr[P_NAME].ToString();
                        lbl.Text = dr[Message_P].ToString();
                        cellLocation[0, index] = lbl.Text;
                        cellLocation[1, index] = dr[CellLocation].ToString();
                        cellLocation[2, index++] = dr[P_NAME].ToString();
                        grbFilter.Controls.Add(lbl);
                        lbl.Location = new System.Drawing.Point(10, height);
                        // set input control
                        switch (dr[DataType].ToString().ToLower())
                        {
                            case "dropdownlist":
                                {
                                    if (dr[P_NAME].ToString().ToLower() == CommonConst.A_EmployeeID.ToLower())
                                    {
                                        ShowEmployeeList(new System.Drawing.Point(130, height), dr[P_NAME].ToString());
                                        break;
                                    }
                                    // create combobox for this once
                                    DevExpress.XtraEditors.LookUpEdit cbx = new DevExpress.XtraEditors.LookUpEdit();
                                    cbx.Name = CBX_PREFIX + dr[P_NAME].ToString();
                                    // set data source
                                    AddDataSource(ref cbx, DBEngine.execReturnDataTable(dr[Query].ToString(), CommonConst.A_LoginID, UserID));
                                    // if the control is month or year list, so set theo current month and year
                                    if (cbx.Name.ToLower().Contains("month"))
                                    {
                                        dtInitValue = DBEngine.execReturnDataTable("select * from tblCurrentWorkingMonth");
                                        cbx.EditValue = dtInitValue.Rows[0]["Month"];
                                    }
                                    if (cbx.Name.ToLower().Contains("year"))
                                    {
                                        dtInitValue = DBEngine.execReturnDataTable("select * from tblCurrentWorkingMonth");
                                        cbx.EditValue = dtInitValue.Rows[0]["Year"];
                                    }
                                    if (cbx.Name.ToLower().Contains("currency"))
                                    {
                                        cbx.EditValue = "VND";
                                    }
                                    grbFilter.Controls.Add(cbx);
                                    cbx.Location = new System.Drawing.Point(130, height);
                                    cbx.Width = 200;
                                    cbx.BringToFront();
                                    break;
                                }
                            case "number":
                            case "int":
                            case "smallint":
                            case "tinyint":
                            case "money":
                                {
                                    // Create textbox and set read number only
                                    TextBox txt = new TextBox();
                                    txt.Name = TXT_PREFIX + dr[P_NAME].ToString();
                                    txt.Location = new System.Drawing.Point(130, height);
                                    txt.Width = 200;
                                    txt.BringToFront();
                                    //set read number only
                                    txt.KeyPress += new KeyPressEventHandler(txt_KeyPress);
                                    grbFilter.Controls.Add(txt);
                                    break;
                                }
                            case "datetime":
                            case "smalldatetime":
                                {
                                    // Create datetimepicker
                                    DevExpress.XtraEditors.DateEdit dtp = new DateEdit();
                                    dtp.Name = DTP_PREFIX + dr[P_NAME].ToString();
                                    dtp.Location = new System.Drawing.Point(130, height);
                                    dtp.Width = 200;
                                    dtp.Properties.LookAndFeel.UseDefaultLookAndFeel = false;
                                    dtp.Properties.LookAndFeel.SkinName = "Blue";
                                    dtp.Properties.Mask.EditMask = "dd/MM/yyyy";
                                    dtp.Properties.Mask.UseMaskAsDisplayFormat = true;
                                    grbFilter.Controls.Add(dtp);
                                    break;
                                }
                            default:
                                {
                                    // Create textbox and set read number only
                                    TextBox txt = new TextBox();
                                    txt.Name = TXT_PREFIX + dr[P_NAME].ToString();
                                    txt.Location = new System.Drawing.Point(130, height);
                                    txt.Width = 200;
                                    txt.BringToFront();
                                    grbFilter.Controls.Add(txt);
                                    // textbox here
                                    break;
                                }
                        }
                    }

                }
                // enable export button
                btnExport.Enabled = true;
                if (txtExportType.Text.Trim().ToLower().Equals(EXPORT_TYPE))
                {
                    ShowHideControl(false);
                }
                else
                {
                    strExtend = txtExcelFileName.Text.Substring(txtExcelFileName.Text.Length - 3, 3);
                    if (strExtend.ToLower().Equals(XLS))
                        ShowHideControl(true);
                    else
                        ShowHideControl(false);
                }
            }
            catch (Exception ex)
            {
                HPA.Common.Helper.ShowException(ex, this.Name, "grvExportList_Click");
            }
        }
示例#22
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(FaceCompareLogger));

            this.panel1           = new Panel();
            this.btn_extport      = new SimpleButton();
            this.btn_Search       = new SimpleButton();
            this.txt_Number       = new TextEdit();
            this.dtp_date         = new DateEdit();
            this.gridControl1     = new GridControl();
            this.gridView1        = new GridView();
            this.PersonID         = new GridColumn();
            this.PersonType       = new GridColumn();
            this.PersonNumber     = new GridColumn();
            this.PersonName       = new GridColumn();
            this.FaceDetcetDate   = new GridColumn();
            this.FaceTempateImage = new GridColumn();
            this.FaceDetcetImage  = new GridColumn();
            this.Similarity       = new GridColumn();
            this.Chanl            = new GridColumn();
            this.btn_TopPage      = new SimpleButton();
            this.btn_EndPage      = new SimpleButton();
            this.btn_Previous     = new SimpleButton();
            this.btn_Next         = new SimpleButton();
            this.lbl_paging       = new Label();
            this.lbl_number       = new Label();
            this.lbl_date         = new Label();
            this.imageList1       = new ImageList();
            this.panel1.SuspendLayout();
            ((ISupportInitialize)this.txt_Number.Properties).BeginInit();
            ((ISupportInitialize)this.dtp_date.Properties.CalendarTimeProperties).BeginInit();
            ((ISupportInitialize)this.dtp_date.Properties).BeginInit();
            ((ISupportInitialize)this.gridControl1).BeginInit();
            ((ISupportInitialize)this.gridView1).BeginInit();
            base.SuspendLayout();
            this.panel1.Controls.Add(this.btn_extport);
            this.panel1.Controls.Add(this.btn_Search);
            this.panel1.Controls.Add(this.txt_Number);
            this.panel1.Controls.Add(this.dtp_date);
            this.panel1.Controls.Add(this.gridControl1);
            this.panel1.Controls.Add(this.btn_TopPage);
            this.panel1.Controls.Add(this.btn_EndPage);
            this.panel1.Controls.Add(this.btn_Previous);
            this.panel1.Controls.Add(this.btn_Next);
            this.panel1.Controls.Add(this.lbl_paging);
            this.panel1.Controls.Add(this.lbl_number);
            this.panel1.Controls.Add(this.lbl_date);
            this.panel1.Dock       = DockStyle.Fill;
            this.panel1.Location   = new Point(1, 1);
            this.panel1.Name       = "panel1";
            this.panel1.Size       = new Size(898, 659);
            this.panel1.TabIndex   = 3;
            this.btn_extport.Image = (Image)componentResourceManager.GetObject("btn_extport.Image");
            this.btn_extport.ImageToTextAlignment = ImageAlignToText.LeftCenter;
            this.btn_extport.Location             = new Point(586, 12);
            this.btn_extport.Name                = "btn_extport";
            this.btn_extport.Size                = new Size(75, 23);
            this.btn_extport.TabIndex            = 15;
            this.btn_extport.Text                = "导出";
            this.btn_extport.Click              += new EventHandler(this.btn_extport_Click);
            this.btn_Search.Image                = (Image)componentResourceManager.GetObject("btn_Search.Image");
            this.btn_Search.ImageToTextAlignment = ImageAlignToText.LeftCenter;
            this.btn_Search.Location             = new Point(493, 12);
            this.btn_Search.Name     = "btn_Search";
            this.btn_Search.Size     = new Size(73, 23);
            this.btn_Search.TabIndex = 15;
            this.btn_Search.Text     = "查 询";
            this.btn_Search.Click   += new EventHandler(this.btn_Select_Click);
            this.txt_Number.Location = new Point(308, 13);
            this.txt_Number.Name     = "txt_Number";
            this.txt_Number.Size     = new Size(173, 20);
            this.txt_Number.TabIndex = 14;
            this.dtp_date.EditValue  = null;
            this.dtp_date.Location   = new Point(62, 13);
            this.dtp_date.Name       = "dtp_date";
            this.dtp_date.Properties.Buttons.AddRange(new EditorButton[]
            {
                new EditorButton(ButtonPredefines.Combo)
            });
            this.dtp_date.Properties.CalendarTimeProperties.Buttons.AddRange(new EditorButton[]
            {
                new EditorButton(ButtonPredefines.Combo)
            });
            this.dtp_date.Size                     = new Size(173, 20);
            this.dtp_date.TabIndex                 = 13;
            this.gridControl1.Location             = new Point(3, 47);
            this.gridControl1.LookAndFeel.SkinName = "Office 2010 Black";
            this.gridControl1.MainView             = this.gridView1;
            this.gridControl1.Name                 = "gridControl1";
            this.gridControl1.Size                 = new Size(892, 574);
            this.gridControl1.TabIndex             = 12;
            this.gridControl1.ViewCollection.AddRange(new BaseView[]
            {
                this.gridView1
            });
            this.gridView1.Columns.AddRange(new GridColumn[]
            {
                this.PersonID,
                this.PersonType,
                this.PersonNumber,
                this.PersonName,
                this.FaceDetcetDate,
                this.FaceTempateImage,
                this.FaceDetcetImage,
                this.Similarity,
                this.Chanl
            });
            this.gridView1.GridControl = this.gridControl1;
            this.gridView1.Name        = "gridView1";
            this.gridView1.OptionsBehavior.Editable   = false;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.gridView1.RowHeight           = 60;
            this.PersonID.Caption              = "人员ID";
            this.PersonID.FieldName            = "PersonID";
            this.PersonID.Name                 = "PersonID";
            this.PersonID.Visible              = true;
            this.PersonID.VisibleIndex         = 0;
            this.PersonType.Caption            = "人员类别";
            this.PersonType.FieldName          = "PersonType";
            this.PersonType.Name               = "PersonType";
            this.PersonType.Visible            = true;
            this.PersonType.VisibleIndex       = 1;
            this.PersonNumber.Caption          = "人员编号";
            this.PersonNumber.FieldName        = "PersonNumber";
            this.PersonNumber.Name             = "PersonNumber";
            this.PersonNumber.Visible          = true;
            this.PersonNumber.VisibleIndex     = 2;
            this.PersonName.Caption            = "人员名称";
            this.PersonName.FieldName          = "PersonName";
            this.PersonName.Name               = "PersonName";
            this.PersonName.Visible            = true;
            this.PersonName.VisibleIndex       = 3;
            this.FaceDetcetDate.Caption        = "识别时间";
            this.FaceDetcetDate.FieldName      = "FaceDetcetDate";
            this.FaceDetcetDate.Name           = "FaceDetcetDate";
            this.FaceDetcetDate.Visible        = true;
            this.FaceDetcetDate.VisibleIndex   = 4;
            this.FaceTempateImage.Caption      = "注册照片";
            this.FaceTempateImage.FieldName    = "FaceTempateImage";
            this.FaceTempateImage.Name         = "FaceTempateImage";
            this.FaceTempateImage.Visible      = true;
            this.FaceTempateImage.VisibleIndex = 5;
            this.FaceDetcetImage.Caption       = "识别照片";
            this.FaceDetcetImage.FieldName     = "FaceDetcetImage";
            this.FaceDetcetImage.Name          = "FaceDetcetImage";
            this.FaceDetcetImage.Visible       = true;
            this.FaceDetcetImage.VisibleIndex  = 6;
            this.Similarity.Caption            = "相似度";
            this.Similarity.FieldName          = "Similarity";
            this.Similarity.Name               = "Similarity";
            this.Similarity.Visible            = true;
            this.Similarity.VisibleIndex       = 7;
            this.Chanl.Caption                 = "识别通道";
            this.Chanl.FieldName               = "Chanl";
            this.Chanl.Name         = "Chanl";
            this.Chanl.Visible      = true;
            this.Chanl.VisibleIndex = 8;
            this.btn_TopPage.ImageToTextAlignment = ImageAlignToText.LeftCenter;
            this.btn_TopPage.Location             = new Point(553, 626);
            this.btn_TopPage.Name                  = "btn_TopPage";
            this.btn_TopPage.RightToLeft           = RightToLeft.No;
            this.btn_TopPage.Size                  = new Size(75, 23);
            this.btn_TopPage.TabIndex              = 8;
            this.btn_TopPage.Text                  = "首页";
            this.btn_TopPage.Click                += new EventHandler(this.btn_head_Click);
            this.btn_EndPage.ImageToTextAlignment  = ImageAlignToText.RightCenter;
            this.btn_EndPage.Location              = new Point(808, 626);
            this.btn_EndPage.Name                  = "btn_EndPage";
            this.btn_EndPage.Size                  = new Size(75, 23);
            this.btn_EndPage.TabIndex              = 7;
            this.btn_EndPage.Text                  = "尾页";
            this.btn_EndPage.Click                += new EventHandler(this.btn_foot_Click);
            this.btn_Previous.ImageToTextAlignment = ImageAlignToText.LeftCenter;
            this.btn_Previous.Location             = new Point(638, 626);
            this.btn_Previous.Name                 = "btn_Previous";
            this.btn_Previous.Size                 = new Size(75, 23);
            this.btn_Previous.TabIndex             = 7;
            this.btn_Previous.Text                 = "上一页";
            this.btn_Previous.Click               += new EventHandler(this.btn_Up_Click);
            this.btn_Next.ImageToTextAlignment     = ImageAlignToText.RightCenter;
            this.btn_Next.Location                 = new Point(723, 626);
            this.btn_Next.Name               = "btn_Next";
            this.btn_Next.Size               = new Size(75, 23);
            this.btn_Next.TabIndex           = 7;
            this.btn_Next.Text               = "下一页";
            this.btn_Next.Click             += new EventHandler(this.btn_Down_Click);
            this.lbl_paging.AutoSize         = true;
            this.lbl_paging.ForeColor        = Color.White;
            this.lbl_paging.Location         = new Point(14, 629);
            this.lbl_paging.Name             = "lbl_paging";
            this.lbl_paging.Size             = new Size(0, 17);
            this.lbl_paging.TabIndex         = 6;
            this.lbl_number.AutoSize         = true;
            this.lbl_number.Font             = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
            this.lbl_number.ForeColor        = Color.White;
            this.lbl_number.Location         = new Point(254, 15);
            this.lbl_number.Name             = "lbl_number";
            this.lbl_number.Size             = new Size(44, 17);
            this.lbl_number.TabIndex         = 1;
            this.lbl_number.Text             = "编号:";
            this.lbl_date.AutoSize           = true;
            this.lbl_date.Font               = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
            this.lbl_date.ForeColor          = Color.White;
            this.lbl_date.Location           = new Point(11, 15);
            this.lbl_date.Name               = "lbl_date";
            this.lbl_date.Size               = new Size(44, 17);
            this.lbl_date.TabIndex           = 1;
            this.lbl_date.Text               = "日期:";
            this.imageList1.ImageStream      = (ImageListStreamer)componentResourceManager.GetObject("imageList1.ImageStream");
            this.imageList1.TransparentColor = Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "video.png");
            base.Appearance.Options.UseFont = true;
            base.AutoScaleMode = AutoScaleMode.None;
            base.ClientSize    = new Size(900, 661);
            base.Controls.Add(this.panel1);
            this.Font            = new Font("微软雅黑", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
            base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            base.MaximizeBox     = false;
            this.MaximumSize     = new Size(916, 697);
            base.MinimizeBox     = false;
            this.MinimumSize     = new Size(916, 697);
            base.Name            = "FaceCompareLogger";
            base.Padding         = new Padding(1);
            base.ShowIcon        = false;
            base.ShowInTaskbar   = false;
            base.StartPosition   = FormStartPosition.CenterScreen;
            this.Text            = "识别记录查看";
            base.FormClosing    += new FormClosingEventHandler(this.FaceCompareLogger_FormClosing);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            ((ISupportInitialize)this.txt_Number.Properties).EndInit();
            ((ISupportInitialize)this.dtp_date.Properties.CalendarTimeProperties).EndInit();
            ((ISupportInitialize)this.dtp_date.Properties).EndInit();
            ((ISupportInitialize)this.gridControl1).EndInit();
            ((ISupportInitialize)this.gridView1).EndInit();
            base.ResumeLayout(false);
        }
示例#23
0
 // Năm trước
 private void Namtruoc(DateEdit tungay, DateEdit denngay)
 {
     DateTime daunam = HelpDate.GetStartOfCurrentYear();
     tungay.EditValue = daunam.AddYears(-1);
     DateTime cuoinam = HelpDate.GetEndOfCurrentYear();
     denngay.EditValue = cuoinam.AddYears(-1);
 }
示例#24
0
 private void SetDate(DateEdit dateEdit)
 {
     switch ( dateEdit.Name )
         {
         case "ClosingPeriodDate":
             SystemConsts.ClosingPeriodDate = dateEdit.DateTime;
             break;
         }
 }
示例#25
0
 // Lấy ngày hiện tại
 private void Ngayhientai(DateEdit tungay, DateEdit denngay)
 {
     tungay.EditValue = DateTime.Now;
     denngay.EditValue = DateTime.Now;
 }
示例#26
0
        void gvDetail_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            GridView gv = sender as GridView;

            if (e.Column.FieldName.ToUpper().Equals("MAVT"))
            {
                //khach hang
                TextEdit txtKh = data.FrmMain.Controls.Find("MaKH", true)[0] as TextEdit;
                //vat tu
                string vt = gv.GetFocusedRowCellValue(e.Column).ToString();
                //ngayCT
                DateEdit dtp = data.FrmMain.Controls.Find("ngayCT", true)[0] as DateEdit;
                string   sql = "select * from ChinhSachGia CSG INNER JOIN GiaVT VT on VT.CSGID=CSG.CSGID " +
                               "LEFT JOIN GiaKH KH on KH.CSGID=CSG.CSGID WHERE VT.MaVT='" + vt + "'";
                DataTable dt      = db.GetDataTable(sql);
                DataView  dvGiaVT = new DataView(dt);
                DataView  dvKH;

                string nhomkh = "";
                sql = "select Nhom1 from dmkh where makh ='" + txtKh.Text + "'";
                DataTable dtNhom = db.GetDataTable(sql);
                if (dtNhom.Rows.Count > 0)
                {
                    nhomkh = dtNhom.Rows[0]["Nhom1"].ToString();
                }
                dvGiaVT.RowFilter = "TuNgay is null and DenNgay is null";

                //nhóm có, mã có
                //nhóm không, mã có

                //nhóm có, mã không
                //nhóm không , mã không

                if (dvGiaVT.Count > 0)
                {
                    dvKH           = new DataView(dvGiaVT.ToTable());
                    dvKH.RowFilter = "MaKH is null and NhomKH is null";
                    if (dvKH.Count == 0)
                    {
                        if (nhomkh != "")
                        {
                            dvKH.RowFilter = "MaKH is null and NhomKH = '" + nhomkh + "'";
                        }
                    }
                    if (dvKH.Count == 0)
                    {
                        dvKH.RowFilter = "MaKH='" + txtKh.Text + "'";
                    }
                    if (dvKH.Count == 0)//kt trường hợp vattu có chính sách giá trong khoảng thời gian hay ko?
                    {
                        dvGiaVT.RowFilter = "TuNgay <= '" + dtp.DateTime + "' and DenNgay >= '" + dtp.DateTime + "'";
                        dvKH           = new DataView(dvGiaVT.ToTable());
                        dvKH.RowFilter = "MaKH is null and NhomKH is null";
                        if (dvKH.Count == 0)
                        {
                            if (nhomkh != "")
                            {
                                dvKH.RowFilter = "MaKH is null and NhomKH = '" + nhomkh + "'";
                            }
                        }
                        if (dvKH.Count == 0)
                        {
                            dvKH.RowFilter = "MaKH='" + txtKh.Text + "'";
                        }
                    }
                }
                else
                {
                    dvGiaVT.RowFilter = "TuNgay <= '" + dtp.DateTime + "' and DenNgay >= '" + dtp.DateTime + "'";
                    dvKH           = new DataView(dvGiaVT.ToTable());
                    dvKH.RowFilter = "MaKH is null and NhomKH is null";
                    if (dvKH.Count == 0)
                    {
                        if (nhomkh != "")
                        {
                            dvKH.RowFilter = "MaKH is null and NhomKH = '" + nhomkh + "'";
                        }
                    }
                    if (dvKH.Count == 0)
                    {
                        dvKH.RowFilter = "MaKH='" + txtKh.Text + "'";
                    }
                }
                setPrice(dvKH, gv);
            }
        }
示例#27
0
 //Tháng 1->12 , Dùng hàm lấy ngày bắt đầu của tháng
 //truyền tham số là tháng cần lấy và năm hiện tại
 private void Thang(DateEdit tungay, DateEdit denngay, int thang)
 {
     DateTime dauthang = HelpDate.GetStartOfMonth(thang, DateTime.Now.Year);
     tungay.EditValue = dauthang;
     DateTime cuoithang = HelpDate.GetEndOfMonth(thang, DateTime.Now.Year);
     denngay.EditValue = cuoithang;
 }
        private Control CreateDSElement(NICSQLTools.Data.dsDataSource.AppDatasourceParamRow ParamRow, string ParamType)
        {
            object ctr = null;
            switch (ParamRow.ParamName)
            {
                case "@SalesDistrict2":
                    ctr = CreateLookupeditForSalesDistrict2();
                    break;
                case "@Materials":
                    ctr = CreateLookupeditForMaterial();
                    break;
                case "@Base_Product":
                    ctr = CreateLookupeditForBaseProduct();
                    break;
                case "@Base_Group":
                    ctr = CreateLookupeditForBaseGroup();
                    break;
                default:// if param have not datasource
                    switch (ParamType.ToLower())
                    {
                        case "nvarchar":
                            TextEdit txt1 = new TextEdit();
                            txt1.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                            ctr = txt1;
                            break;
                        case "int":
                        case "smallint":
                        case "bigint":
                            TextEdit txt2 = new TextEdit();
                            txt2.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                            txt2.Properties.DisplayFormat.FormatString = "n0";
                            txt2.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            txt2.Properties.EditFormat.FormatString = "n0";
                            txt2.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            txt2.Properties.Mask.EditMask = "n0";
                            txt2.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                            ctr = txt2;
                            break;
                        case "float":
                            TextEdit txt3 = new TextEdit();
                            txt3.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                            txt3.Properties.DisplayFormat.FormatString = "f2";
                            txt3.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            txt3.Properties.EditFormat.FormatString = "f2";
                            txt3.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                            txt3.Properties.Mask.EditMask = "f2";
                            txt3.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                            ctr = txt3;
                            break;
                        case "datetime":
                            DateEdit de1 = new DateEdit();
                            de1.EditValue = null;
                            de1.Name = String.Format("ctr{0}{1}{2}", ParamRow.ParamName, ParamRow.AppDatasourceParamID, ParamRow.DatasourceID);
                            de1.Properties.DisplayFormat.FormatString = "d/M/yyyy";
                            de1.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                            de1.Properties.EditFormat.FormatString = "d/M/yyyy";
                            de1.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                            de1.Properties.Mask.EditMask = "d/M/yyyy";
                            de1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
                            ctr = de1;
                            break;
                        default:
                            break;
                    }
                    break;
            }

            ((TextEdit)ctr).Properties.NullValuePrompt = ParamRow.ParamDisplayName;
            return (Control)ctr;
        }
示例#29
0
 // Tuần vừa rồi
 private void Tuanvuaroi(DateEdit tungay, DateEdit denngay)
 {
     DateTime dautuan = HelpDate.GetStartOfCurrentWeek();
     DateTime cuoituan = HelpDate.GetEndOfCurrentWeek();
     tungay.EditValue = dautuan.AddDays(-7);
     denngay.EditValue = cuoituan.AddDays(-7);
 }
示例#30
0
        public void loadctmvt(string active, string role, DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, TextEdit txtsct, ComboBoxEdit cbldt, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                              DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit tkno, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit tkco, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang,
                              DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, Frm_phieuthuvt F, LookUpEdit ledt, TextEdit txtnn, TextEdit txtldn, TextEdit txtctg,
                              ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, string tsbt, ComboBoxEdit cbthue, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, TextEdit txtcth, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, DataTable khach, DataTable hang)
        {
            DataTable    dt     = new DataTable();
            phieuthutmvt pttmvt = new phieuthutmvt();

            pttmvt.loadstart(gridControl1, gridView1, cbldt, ledv, denct, denht, tkno, tkco, mahang, soluong, dongia, thanhtien, ledt, tsbtsua, tsbtxoa, tsbtcat, tsbtboghi, tsbtghiso, tsbtnap, tsbtin, ngaychungtu, dt, tsbt, cbthue, khach, hang);
            if (active == "1")
            {
                DataTable da = new DataTable();
                da = gen.GetTable("select  DebitAccount,CreditAccount,Amount,InventoryItemCode,a.SalePrice,Quantity from SUCAPaymentDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + role + "' order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = da.Rows[i][0].ToString();
                    dr[1] = da.Rows[i][1].ToString();
                    dr[2] = da.Rows[i][3].ToString();
                    dr[3] = da.Rows[i][5].ToString();
                    dr[4] = da.Rows[i][4].ToString();
                    dr[5] = da.Rows[i][2].ToString();
                    dt.Rows.Add(dr);
                }
                gridControl1.DataSource = dt;
                tsbtcat.Enabled         = false;

                F.Text = "Xem phiếu chi tiềm mặt mua vật tư";
                da     = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,Tax,InvDate,InvSeries,InvNo  from SUCAPayment a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + role + "'");
                try
                {
                    cbldt.SelectedIndex = Int32.Parse(da.Rows[0][9].ToString());
                }
                catch { }
                ledv.EditValue  = da.Rows[0][7].ToString();
                ledt.EditValue  = da.Rows[0][0].ToString();
                txtnn.Text      = da.Rows[0][1].ToString();
                txtldn.Text     = da.Rows[0][2].ToString();
                txtctg.Text     = da.Rows[0][3].ToString();
                denct.EditValue = DateTime.Parse(da.Rows[0][4].ToString());
                denht.EditValue = DateTime.Parse(da.Rows[0][5].ToString());
                txtsct.Text     = da.Rows[0][6].ToString();
                txtshd.Text     = da.Rows[0][14].ToString();
                try
                {
                    txtnhd.EditValue = DateTime.Parse(da.Rows[0][12].ToString());
                }
                catch { txtnhd.Text = ""; }
                txtkhhd.Text = da.Rows[0][13].ToString();
                try
                {
                    cbthue.Text = da.Rows[0][11].ToString();
                }
                catch { }
                if (da.Rows[0][8].ToString() == "True")
                {
                    tsbtghiso.Visible = false;
                    tsbtboghi.Visible = true;
                    tsbtsua.Enabled   = false;
                }
                else
                {
                    tsbtboghi.Visible = false;
                    tsbtghiso.Visible = true;
                }
                if (da.Rows[0][10].ToString() == "True")
                {
                    tsbtboghi.Enabled = false;
                    tsbtghiso.Enabled = false;
                }
                txtcth.Text = gridView1.Columns["Thành tiền"].SummaryText;
                checktruocsau(tsbttruoc, tsbtsau, ledv.EditValue.ToString(), txtsct.Text, ngaychungtu);
            }
            else
            {
                try
                {
                    F.Text = "Thêm phiếu chi tiền mặt mua vật tư";
                    if (role == null)
                    {
                        ledv.ItemIndex = 0;
                    }
                    else
                    {
                        ledv.EditValue = role;
                    }
                    denct.EditValue = DateTime.Parse(ngaychungtu);
                    denht.EditValue = DateTime.Parse(ngaychungtu);
                    txtcth.Text     = gridView1.Columns["Thành tiền"].SummaryText;
                }
                catch
                {
                    XtraMessageBox.Show("Vui lòng kiểm tra lại < Ngày chứng từ >.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    F.Close();
                }
            }
        }
示例#31
0
 private void InitializeComponent()
 {
     this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
     this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
     this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
     this.checkEdit1    = new DevExpress.XtraEditors.CheckEdit();
     this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
     this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
     this.textEdit1     = new DevExpress.XtraEditors.TextEdit();
     this.dateEdit1     = new DevExpress.XtraEditors.DateEdit();
     ((System.ComponentModel.ISupportInitialize)(this.checkEdit1.Properties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties.VistaTimeProperties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).BeginInit();
     this.SuspendLayout();
     //
     // labelControl1
     //
     this.labelControl1.Appearance.Font      = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold);
     this.labelControl1.Appearance.ForeColor = System.Drawing.Color.Red;
     this.labelControl1.Location             = new System.Drawing.Point(12, 24);
     this.labelControl1.Name     = "labelControl1";
     this.labelControl1.Size     = new System.Drawing.Size(572, 23);
     this.labelControl1.TabIndex = 0;
     this.labelControl1.Text     = "Cảnh báo: khởi tạo dữ liệu mới, dữ liệu cũ sẽ mất hoàn toàn";
     //
     // labelControl2
     //
     this.labelControl2.Location = new System.Drawing.Point(148, 99);
     this.labelControl2.Name     = "labelControl2";
     this.labelControl2.Size     = new System.Drawing.Size(59, 13);
     this.labelControl2.TabIndex = 1;
     this.labelControl2.Text     = "Trước ngày:";
     //
     // labelControl3
     //
     this.labelControl3.Location = new System.Drawing.Point(148, 124);
     this.labelControl3.Name     = "labelControl3";
     this.labelControl3.Size     = new System.Drawing.Size(46, 13);
     this.labelControl3.TabIndex = 2;
     this.labelControl3.Text     = "Password";
     //
     // checkEdit1
     //
     this.checkEdit1.Location           = new System.Drawing.Point(244, 154);
     this.checkEdit1.Name               = "checkEdit1";
     this.checkEdit1.Properties.Caption = "Xóa danh mục";
     this.checkEdit1.Size               = new System.Drawing.Size(102, 19);
     this.checkEdit1.TabIndex           = 3;
     //
     // simpleButton1
     //
     this.simpleButton1.Location = new System.Drawing.Point(246, 196);
     this.simpleButton1.Name     = "simpleButton1";
     this.simpleButton1.Size     = new System.Drawing.Size(75, 23);
     this.simpleButton1.TabIndex = 4;
     this.simpleButton1.Text     = "Chấp nhận";
     this.simpleButton1.Click   += new System.EventHandler(this.simpleButton1_Click_1);
     //
     // labelControl4
     //
     this.labelControl4.Appearance.Font      = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold);
     this.labelControl4.Appearance.ForeColor = System.Drawing.Color.Red;
     this.labelControl4.Location             = new System.Drawing.Point(148, 67);
     this.labelControl4.Name     = "labelControl4";
     this.labelControl4.Size     = new System.Drawing.Size(240, 23);
     this.labelControl4.TabIndex = 5;
     this.labelControl4.Text     = "Bạn có chắc chắn không?";
     //
     // textEdit1
     //
     this.textEdit1.Location = new System.Drawing.Point(246, 121);
     this.textEdit1.Name     = "textEdit1";
     this.textEdit1.Properties.PasswordChar = '*';
     this.textEdit1.Size     = new System.Drawing.Size(100, 20);
     this.textEdit1.TabIndex = 6;
     //
     // dateEdit1
     //
     this.dateEdit1.EditValue = null;
     this.dateEdit1.Location  = new System.Drawing.Point(246, 96);
     this.dateEdit1.Name      = "dateEdit1";
     this.dateEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
         new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
     });
     this.dateEdit1.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
     this.dateEdit1.Properties.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
     this.dateEdit1.Properties.EditFormat.FormatString    = "dd/MM/yyyy";
     this.dateEdit1.Properties.EditFormat.FormatType      = DevExpress.Utils.FormatType.DateTime;
     this.dateEdit1.Properties.Mask.EditMask = "dd/MM/yyyy";
     this.dateEdit1.Properties.VistaTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
         new DevExpress.XtraEditors.Controls.EditorButton()
     });
     this.dateEdit1.Size     = new System.Drawing.Size(100, 20);
     this.dateEdit1.TabIndex = 7;
     //
     // Xoasolieu
     //
     this.ClientSize = new System.Drawing.Size(590, 230);
     this.Controls.Add(this.dateEdit1);
     this.Controls.Add(this.textEdit1);
     this.Controls.Add(this.labelControl4);
     this.Controls.Add(this.simpleButton1);
     this.Controls.Add(this.checkEdit1);
     this.Controls.Add(this.labelControl3);
     this.Controls.Add(this.labelControl2);
     this.Controls.Add(this.labelControl1);
     this.Name = "Xoasolieu";
     this.Text = "Xóa số liệu";
     ((System.ComponentModel.ISupportInitialize)(this.checkEdit1.Properties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties.VistaTimeProperties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
示例#32
0
        //save//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void checkpctmvt(string active, string role, Frm_phieuthuvt F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, ComboBoxEdit cbldt, TextEdit txtsct, TextEdit txtname, TextEdit txtdc,
                                TextEdit txtnn, TextEdit txtctg, TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                                ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, ComboBoxEdit cbthue, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, string userid, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau)
        {
            try
            {
                string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
                string[,] detail = new string[20, 8];
                string check = "0";
                for (int i = 0; i < gridView1.RowCount - 1; i++)
                {
                    if (gridView1.GetRowCellValue(i, "Tài khoản có").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 0] = gridView1.GetRowCellValue(i, "Tài khoản có").ToString();
                    if (gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 1] = gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString();
                    if (gridView1.GetRowCellValue(i, "Mã hàng").ToString() == "")
                    {
                        check = "1";
                    }
                    else
                    {
                        string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                        detail[i, 2] = mh;
                    }

                    if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 3] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                    if (gridView1.GetRowCellValue(i, "Đơn giá").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 4] = gridView1.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "").Replace(",", ".");
                    if (gridView1.GetRowCellValue(i, "Thành tiền").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 5] = gridView1.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
                }
                if (check == "1")
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Tài khoản có> <Tài khoản nợ> <Mã hàng> <Số lượng> <Đơn giá> <Thành tiền> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string dv   = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                    string tong = gridView1.Columns["Thành tiền"].SummaryText;
                    tong = tong.Replace(".", "");
                    string ldt;
                    if (cbldt.EditValue.ToString() == "Khách hàng")
                    {
                        ldt = "0";
                    }
                    else if (cbldt.EditValue.ToString() == "Nhà cung cấp")
                    {
                        ldt = "1";
                    }
                    else
                    {
                        ldt = "2";
                    }
                    string nhd = txtnhd.Text;
                    if (active == "0")
                    {
                        try
                        {
                            string ton = gen.GetString("select * from SUCAPayment where RefNo='" + txtsct.Text + "'");
                            themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), tsbttruoc, tsbtsau);
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }
                        if (nhd == "")
                        {
                            gen.ExcuteNonquery("insert into SUCAPayment(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,AccountingObjectAddress,Contactname,JournalMemo,DocumentIncluded,Posted,StockID,AccountingObjectType,TotalAmount,Tax,InvSeries,InvNo,EmployeeID) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "','" + txtdc.Text + "',N'" + txtnn.Text + "',N'" + txtldn.Text + "',N'" + txtctg.Text + "','False','" + dv + "','" + ldt + "','" + tong + "','" + cbthue.Text + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + userid + "')");
                        }
                        else
                        {
                            gen.ExcuteNonquery("insert into SUCAPayment(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,AccountingObjectAddress,Contactname,JournalMemo,DocumentIncluded,Posted,StockID,AccountingObjectType,TotalAmount,Tax,InvDate,InvSeries,InvNo,EmployeeID) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "','" + txtdc.Text + "',N'" + txtnn.Text + "',N'" + txtldn.Text + "',N'" + txtctg.Text + "','False','" + dv + "','" + ldt + "','" + tong + "','" + cbthue.Text + "','" + txtnhd.EditValue.ToString() + "','" + txtkhhd.Text + "','" + txtshd.Text + "','" + userid + "')");
                        }
                        string refid = gen.GetString("select * from SUCAPayment where RefNo='" + txtsct.Text + "'");
                        F.getrole(refid);
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into SUCAPaymentDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,SalePrice) values(newid(),'" + refid + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "')");
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain,Goods) values(newid(),'" + refid + "','" + txtsct.Text + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "','" + dv + "')");
                        }
                    }
                    else
                    {
                        if (nhd == "")
                        {
                            gen.ExcuteNonquery("update SUCAPayment set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',AccountingObjectAddress='" + txtdc.Text + "',Contactname=N'" + txtnn.Text + "',JournalMemo=N'" + txtldn.Text + "',DocumentIncluded=N'" + txtctg.Text + "',StockID='" + dv + "',AccountingObjectType='" + ldt + "',TotalAmount='" + tong + "',Posted='False',Tax='" + cbthue.Text + "',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',EmployeeID='" + userid + "'  where RefID='" + role + "'");
                        }
                        else
                        {
                            gen.ExcuteNonquery("update SUCAPayment set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',AccountingObjectAddress='" + txtdc.Text + "',Contactname=N'" + txtnn.Text + "',JournalMemo=N'" + txtldn.Text + "',DocumentIncluded=N'" + txtctg.Text + "',StockID='" + dv + "',AccountingObjectType='" + ldt + "',TotalAmount='" + tong + "',Posted='False',Tax='" + cbthue.Text + "',InvSeries='" + txtkhhd.Text + "',InvNo='" + txtshd.Text + "',InvDate='" + txtnhd.EditValue.ToString() + "',EmployeeID='" + userid + "'  where RefID='" + role + "'");
                        }
                        gen.ExcuteNonquery("delete  from  SUCAPaymentDetail where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete HACHTOAN where RefID='" + role + "'");
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into SUCAPaymentDetail(RefDetailID,RefID,DebitAccount,CreditAccount,Amount,Quantity,SortOrder,InventoryItemID,SalePrice) values(newid(),'" + role + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 3] + "'," + i + ",'" + detail[i, 2] + "','" + detail[i, 4] + "')");
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain,Goods) values(newid(),'" + role + "','" + txtsct.Text + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "','" + dv + "')");
                        }
                    }
                    F.myac();
                    F.getactive("1");
                    F.Text = "Xem phiếu thu tiền mặt bán vật tư";
                }
            }
            catch
            {
                XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#33
0
        public void loadstart(DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, ComboBoxEdit cbldt, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                              DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, LookUpEdit ledt, ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat,
                              ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripSplitButton tsbtin, string ngaychungtu, string userid, string branchid, string active, DataTable dt, DataTable dt1, DevExpress.XtraGrid.GridControl gridControl2, GridView gridView2, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, LookUpEdit lenv)
        {
            cbldt.Properties.Items.Clear();
            cbldt.Properties.Items.Add("Khách hàng");
            cbldt.Properties.Items.Add("Nhà cung cấp");
            cbldt.Properties.Items.Add("Nhân viên");
            cbldt.SelectedIndex = 0;

            DataTable da   = new DataTable();
            DataTable temp = new DataTable();

            temp.Columns.Add("Mã kho");
            temp.Columns.Add("Tên kho");
            da = gen.GetTable("select * from Stock where StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') order by StockCode");
            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dr = temp.NewRow();
                dr[0] = da.Rows[i][1].ToString();
                dr[1] = da.Rows[i][2].ToString();
                temp.Rows.Add(dr);
            }
            ledv.Properties.DataSource    = temp;
            ledv.Properties.DisplayMember = "Mã kho";
            ledv.Properties.ValueMember   = "Mã kho";
            ledv.Properties.PopupWidth    = 300;

            da = gen.GetTable("select InventoryItemCode,InventoryItemName from InventoryItem where InventoryItemID in (select Parent from InventoryItem ) order by InventoryItemCode");
            DataTable temp3 = new DataTable();

            temp3.Columns.Add("Mã hàng");
            temp3.Columns.Add("Tên hàng");
            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dr = temp3.NewRow();
                dr[0] = da.Rows[i][0].ToString();
                dr[1] = da.Rows[i][1].ToString();
                temp3.Rows.Add(dr);
            }
            mahang.DataSource    = temp3;
            mahang.DisplayMember = "Mã hàng";
            mahang.ValueMember   = "Mã hàng";

            da = gen.GetTable("select AccountingObjectCode,AccountingObjectName from AccountingObject a, Branch b where a.BranchID=b.BranchID and b.BranchID='" + branchid + "' and IsEmployee='True' order by AccountingObjectCode");
            DataTable temp4 = new DataTable();

            temp4.Columns.Add("Mã nhân viên");
            temp4.Columns.Add("Tên nhân viên");
            for (int i = 0; i < da.Rows.Count; i++)
            {
                DataRow dr = temp4.NewRow();
                dr[0] = da.Rows[i][0].ToString();
                dr[1] = da.Rows[i][1].ToString();
                temp4.Rows.Add(dr);
            }
            lenv.Properties.DataSource    = temp4;
            lenv.Properties.DisplayMember = "Mã nhân viên";
            lenv.Properties.ValueMember   = "Mã nhân viên";
            lenv.Properties.PopupWidth    = 300;

            dt.Columns.Add("Mã hàng", Type.GetType("System.String"));
            dt.Columns.Add("Tên hàng");
            dt.Columns.Add("Số lượng", Type.GetType("System.Double"));
            dt.Columns.Add("Số lượng quy đổi", Type.GetType("System.Double"));
            dt.Columns.Add("Diễn giải");
            gridControl1.DataSource = dt;
            gridView1.Columns["Mã hàng"].ColumnEdit          = mahang;
            gridView1.Columns["Số lượng"].ColumnEdit         = soluong;
            gridView1.Columns["Số lượng quy đổi"].ColumnEdit = soluongqd;

            gridView1.Columns["Diễn giải"].Width = 300;

            gridView1.Columns["Số lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Số lượng"].DisplayFormat.FormatString = "{0:n0}";

            gridView1.Columns["Số lượng quy đổi"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView1.Columns["Số lượng quy đổi"].DisplayFormat.FormatString = "{0:n2}";

            gridView1.Columns["Số lượng"].SummaryItem.SummaryType           = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Số lượng"].SummaryItem.DisplayFormat         = "{0:n0}";
            gridView1.Columns["Số lượng quy đổi"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridView1.Columns["Số lượng quy đổi"].SummaryItem.DisplayFormat = "{0:n2}";

            gridView1.Columns[0].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            gridView1.Columns[0].SummaryItem.DisplayFormat = "Số dòng = {0}";


            dt1.Columns.Add("Mã hàng", Type.GetType("System.String"));
            dt1.Columns.Add("Tên hàng");
            dt1.Columns.Add("Số lượng", Type.GetType("System.Double"));
            dt1.Columns.Add("Đơn giá", Type.GetType("System.Double"));
            dt1.Columns.Add("Thành tiền", Type.GetType("System.Double"));
            dt1.Columns.Add("Diễn giải");
            gridControl2.DataSource = dt1;
            gridView2.Columns["Đơn giá"].ColumnEdit    = dongia;
            gridView2.Columns["Thành tiền"].ColumnEdit = thanhtien;

            gridView2.Columns["Số lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView2.Columns["Số lượng"].DisplayFormat.FormatString = "{0:n0}";

            gridView2.Columns["Số lượng"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            gridView2.Columns["Số lượng"].SummaryItem.DisplayFormat = "{0:n0}";

            gridView2.Columns["Đơn giá"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView2.Columns["Đơn giá"].DisplayFormat.FormatString = "{0:n2}";
            gridView2.Columns["Đơn giá"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView2.Columns["Đơn giá"].SummaryItem.DisplayFormat  = "{0:n2}";

            gridView2.Columns["Thành tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            gridView2.Columns["Thành tiền"].DisplayFormat.FormatString = "{0:n0}";
            gridView2.Columns["Thành tiền"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            gridView2.Columns["Thành tiền"].SummaryItem.DisplayFormat  = "{0:n0}";

            gridView2.Columns[0].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            gridView2.Columns[0].SummaryItem.DisplayFormat = "Số dòng = {0}";

            gridView2.Columns["Mã hàng"].OptionsColumn.AllowEdit  = false;
            gridView2.Columns["Tên hàng"].OptionsColumn.AllowEdit = false;
            gridView2.Columns["Số lượng"].OptionsColumn.AllowEdit = false;
        }
示例#34
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.label1        = new System.Windows.Forms.Label();
     this.label2        = new System.Windows.Forms.Label();
     this.textEdit1     = new DevExpress.XtraEditors.TextEdit();
     this.label3        = new System.Windows.Forms.Label();
     this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
     this.simpleButton2 = new DevExpress.XtraEditors.SimpleButton();
     this.dateEdit1     = new DevExpress.XtraEditors.DateEdit();
     this.memoEdit1     = new DevExpress.XtraEditors.MemoEdit();
     ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.memoEdit1.Properties)).BeginInit();
     this.SuspendLayout();
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Location = new System.Drawing.Point(43, 33);
     this.label1.Name     = "label1";
     this.label1.Size     = new System.Drawing.Size(79, 14);
     this.label1.TabIndex = 0;
     this.label1.Text     = "计划表名称:";
     //
     // label2
     //
     this.label2.AutoSize = true;
     this.label2.Location = new System.Drawing.Point(43, 74);
     this.label2.Name     = "label2";
     this.label2.Size     = new System.Drawing.Size(67, 14);
     this.label2.TabIndex = 2;
     this.label2.Text     = "创建时间:";
     //
     // textEdit1
     //
     this.textEdit1.ImeMode              = System.Windows.Forms.ImeMode.On;
     this.textEdit1.Location             = new System.Drawing.Point(128, 30);
     this.textEdit1.Name                 = "textEdit1";
     this.textEdit1.Properties.MaxLength = 100;
     this.textEdit1.Size                 = new System.Drawing.Size(228, 21);
     this.textEdit1.TabIndex             = 1;
     this.textEdit1.EditValueChanged    += new System.EventHandler(this.textEdit1_EditValueChanged);
     //
     // label3
     //
     this.label3.AutoSize = true;
     this.label3.Location = new System.Drawing.Point(43, 117);
     this.label3.Name     = "label3";
     this.label3.Size     = new System.Drawing.Size(43, 14);
     this.label3.TabIndex = 5;
     this.label3.Text     = "备注:";
     //
     // simpleButton1
     //
     this.simpleButton1.Location = new System.Drawing.Point(171, 183);
     this.simpleButton1.Name     = "simpleButton1";
     this.simpleButton1.Size     = new System.Drawing.Size(75, 26);
     this.simpleButton1.TabIndex = 5;
     this.simpleButton1.Text     = "确定(&O)";
     this.simpleButton1.Click   += new System.EventHandler(this.simpleButton1_Click);
     //
     // simpleButton2
     //
     this.simpleButton2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.simpleButton2.Location     = new System.Drawing.Point(264, 183);
     this.simpleButton2.Name         = "simpleButton2";
     this.simpleButton2.Size         = new System.Drawing.Size(75, 26);
     this.simpleButton2.TabIndex     = 6;
     this.simpleButton2.Text         = "取消(&C)";
     //
     // dateEdit1
     //
     this.dateEdit1.EditValue = null;
     this.dateEdit1.Location  = new System.Drawing.Point(128, 71);
     this.dateEdit1.Name      = "dateEdit1";
     this.dateEdit1.Properties.Appearance.BackColor            = System.Drawing.SystemColors.Window;
     this.dateEdit1.Properties.Appearance.Options.UseBackColor = true;
     this.dateEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
         new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
     });
     this.dateEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
     this.dateEdit1.Size     = new System.Drawing.Size(228, 21);
     this.dateEdit1.TabIndex = 7;
     //
     // memoEdit1
     //
     this.memoEdit1.Location = new System.Drawing.Point(128, 115);
     this.memoEdit1.Name     = "memoEdit1";
     this.memoEdit1.Size     = new System.Drawing.Size(228, 46);
     this.memoEdit1.TabIndex = 8;
     //
     // FormForecastReport
     //
     this.AcceptButton = this.simpleButton1;
     this.CancelButton = this.simpleButton2;
     this.ClientSize   = new System.Drawing.Size(384, 235);
     this.Controls.Add(this.memoEdit1);
     this.Controls.Add(this.dateEdit1);
     this.Controls.Add(this.simpleButton2);
     this.Controls.Add(this.simpleButton1);
     this.Controls.Add(this.label3);
     this.Controls.Add(this.textEdit1);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.label1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "FormForecastReport";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text            = "FormForecastReport";
     this.Load           += new System.EventHandler(this.FormForecastReport_Load);
     ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.dateEdit1.Properties)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.memoEdit1.Properties)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
示例#35
0
        public void checkpnk(string active, string role, Frm_phieunhapgas F, GridView gridView1, GridView gridView2, LookUpEdit ledt, LookUpEdit ledv, ComboBoxEdit cbldt, TextEdit txtsct, TextEdit txtname, TextEdit txtdc,
                             TextEdit txtngh, TextEdit txtctg, TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                             ToolStripButton tsbtcat, ToolStripSplitButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, TextEdit txtmst, TextEdit txtptvc, string userid, string branchid, TextEdit txtpnv, LookUpEdit lenv, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau)
        {
            try
            {
                string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
                string[,] detail  = new string[20, 8];
                string[,] detail1 = new string[20, 8];
                string check = "0";
                for (int i = 0; i < gridView1.RowCount - 1; i++)
                {
                    if (gridView1.GetRowCellValue(i, "Mã hàng").ToString() == "")
                    {
                        check = "1";
                    }
                    else
                    {
                        string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView1.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                        detail[i, 0] = mh;
                    }
                    if (gridView1.GetRowCellValue(i, "Số lượng").ToString() == "")
                    {
                        detail[i, 1] = "0";
                    }
                    else
                    {
                        detail[i, 1] = gridView1.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "").Replace(",", ".");
                    }
                    if (gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 2] = gridView1.GetRowCellValue(i, "Số lượng quy đổi").ToString().Replace(".", "").Replace(",", ".");
                    detail[i, 3] = gridView1.GetRowCellValue(i, "Diễn giải").ToString();
                }

                for (int i = 0; i < gridView2.RowCount; i++)
                {
                    if (gridView2.GetRowCellValue(i, "Mã hàng").ToString() == "")
                    {
                        check = "1";
                    }
                    else
                    {
                        string mh = gen.GetString("select * from InventoryItem where InventoryItemCode='" + gridView2.GetRowCellValue(i, "Mã hàng").ToString() + "'");
                        detail1[i, 0] = mh;
                    }

                    if (gridView2.GetRowCellValue(i, "Số lượng").ToString() == "")
                    {
                        check = "1";
                    }
                    detail1[i, 1] = gridView2.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                    detail1[i, 2] = gridView2.GetRowCellValue(i, "Số lượng").ToString().Replace(".", "");
                    detail1[i, 3] = gridView2.GetRowCellValue(i, "Diễn giải").ToString();

                    if (gridView2.GetRowCellValue(i, "Đơn giá").ToString() == "")
                    {
                        check = "1";
                    }
                    detail1[i, 4] = gridView2.GetRowCellValue(i, "Đơn giá").ToString().Replace(".", "");
                    if (gridView2.GetRowCellValue(i, "Thành tiền").ToString() == "")
                    {
                        check = "1";
                    }
                    detail1[i, 5] = gridView2.GetRowCellValue(i, "Thành tiền").ToString().Replace(".", "");
                }

                if (check == "1")
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Mã hàng> <Số lượng quy đổi> <Đơn giá> <Thành tiền> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string dv = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                    string ldt;
                    if (cbldt.EditValue.ToString() == "Khách hàng")
                    {
                        ldt = "0";
                    }
                    else if (cbldt.EditValue.ToString() == "Nhà cung cấp")
                    {
                        ldt = "1";
                    }
                    else
                    {
                        ldt = "2";
                    }
                    string tongtien = gridView2.Columns["Thành tiền"].SummaryText.Replace(".", "");
                    string nv       = "";
                    try
                    {
                        nv = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + lenv.EditValue.ToString() + "'");
                    }
                    catch { }

                    if (active == "0")
                    {
                        try
                        {
                            string ton = gen.GetString("select * from INInward where RefNo='" + txtsct.Text + "'");
                            themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), branchid, txtpnv, tsbttruoc, tsbtsau);
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }
                        try
                        {
                            string ton = gen.GetString("select * from INInwardSU where RefNo='" + txtpnv.Text + "'");
                            themsct(ngaychungtu, txtsct, ledv.EditValue.ToString(), branchid, txtpnv, tsbttruoc, tsbtsau);
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtpnv.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }

                        try
                        {
                            gen.ExcuteNonquery("insert into INInward(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,AccountingObjectAddress,Contactname,JournalMemo,DocumentIncluded,Posted,StockID,AccountingObjectType,ShippingNo,EmployeeID,EmployeeIDPU) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtdc.Text + "',N'" + txtngh.Text + "',N'" + txtldn.Text + "',N'" + txtctg.Text + "','False','" + dv + "','" + ldt + "','" + txtptvc.Text + "','" + userid + "','" + nv + "')");
                        }
                        catch
                        {
                            gen.ExcuteNonquery("insert into INInward(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,AccountingObjectAddress,Contactname,JournalMemo,DocumentIncluded,Posted,StockID,AccountingObjectType,ShippingNo,EmployeeID) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtdc.Text + "',N'" + txtngh.Text + "',N'" + txtldn.Text + "',N'" + txtctg.Text + "','False','" + dv + "','" + ldt + "','" + txtptvc.Text + "','" + userid + "')");
                        }
                        string refid = gen.GetString("select * from INInward where RefNo='" + txtsct.Text + "'");
                        F.getrole(refid);
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into INInwardDetail(RefDetailID,RefID,Quantity,QuantityConvert,SortOrder,InventoryItemID,Description,QuantityExits,QuantityConvertExits) values(newid(),'" + refid + "','" + detail[i, 1] + "','" + detail[i, 2] + "'," + i + ",'" + detail[i, 0] + "',N'" + detail[i, 3] + "',0,0)");
                        }

                        gen.ExcuteNonquery("insert into INInwardSU(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,AccountingObjectAddress,Contactname,JournalMemo,DocumentIncluded,Posted,StockID,AccountingObjectType,ShippingNo,TotalAmount,EmployeeID) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtpnv.Text + "','" + dt + "',N'" + txtname.Text + "',N'" + txtdc.Text + "',N'" + txtngh.Text + "',N'" + txtldn.Text + "',N'" + txtctg.Text + "','False','" + dv + "','" + ldt + "','" + txtptvc.Text + "','" + tongtien + "','" + userid + "')");
                        string id = gen.GetString("select * from INInwardSU where RefNo='" + txtpnv.Text + "'");
                        gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + id + "','" + txtsct.Text + "','1563','3313','" + tongtien + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");
                        gen.ExcuteNonquery("update INInward set refSUID='" + id + "' where refID='" + refid + "' ");
                        for (int i = 0; i < gridView2.RowCount; i++)
                        {
                            gen.ExcuteNonquery("insert into INInwardSUDetail(RefDetailID,RefID,Quantity,QuantityConvert,SortOrder,InventoryItemID,Description,QuantityExits,QuantityConvertExits,UnitPrice,Amount,DebitAccount,CreditAccount) values(newid(),'" + id + "','" + detail1[i, 1] + "','" + detail1[i, 2] + "'," + i + ",'" + detail1[i, 0] + "',N'" + detail1[i, 3] + "',0,0,'" + detail1[i, 4] + "','" + detail1[i, 5] + "','1563','3313')");
                        }
                    }
                    else
                    {
                        try
                        {
                            gen.ExcuteNonquery("update INInward set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',AccountingObjectAddress=N'" + txtdc.Text + "',Contactname=N'" + txtngh.Text + "',JournalMemo=N'" + txtldn.Text + "',DocumentIncluded=N'" + txtctg.Text + "',StockID='" + dv + "',AccountingObjectType='" + ldt + "',Posted='False',ShippingNo='" + txtptvc.Text + "',EmployeeID='" + userid + "',EmployeeIDPU='" + nv + "'  where RefID='" + role + "'");
                        }
                        catch
                        {
                            gen.ExcuteNonquery("update INInward set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',AccountingObjectAddress=N'" + txtdc.Text + "',Contactname=N'" + txtngh.Text + "',JournalMemo=N'" + txtldn.Text + "',DocumentIncluded=N'" + txtctg.Text + "',StockID='" + dv + "',AccountingObjectType='" + ldt + "',Posted='False',ShippingNo='" + txtptvc.Text + "',EmployeeID='" + userid + "',EmployeeIDPU=Null  where RefID='" + role + "'");
                        }
                        gen.ExcuteNonquery("delete  from  INInwardDetail where RefID='" + role + "'");
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            gen.ExcuteNonquery("insert into INInwardDetail(RefDetailID,RefID,Quantity,QuantityConvert,SortOrder,InventoryItemID,Description,QuantityExits,QuantityConvertExits) values(newid(),'" + role + "','" + detail[i, 1] + "','" + detail[i, 2] + "'," + i + ",'" + detail[i, 0] + "',N'" + detail[i, 3] + "',0,0)");
                        }

                        string id = gen.GetString("select refSUID from INInward where refID='" + role + "'");
                        gen.ExcuteNonquery("update INInwardSU set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',AccountingObjectAddress=N'" + txtdc.Text + "',Contactname=N'" + txtngh.Text + "',JournalMemo=N'" + txtldn.Text + "',DocumentIncluded=N'" + txtctg.Text + "',StockID='" + dv + "',AccountingObjectType='" + ldt + "',Posted='False',ShippingNo='" + txtptvc.Text + "',TotalAmount='" + tongtien + "',EmployeeID='" + userid + "'  where RefID = '" + id + "'");
                        gen.ExcuteNonquery("delete  from  INInwardSUDetail where RefID ='" + id + "'");
                        gen.ExcuteNonquery("delete HACHTOAN where RefID='" + id + "'");
                        gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain) values(newid(),'" + id + "','" + txtsct.Text + "','1563','3313','" + tongtien + "','" + dt + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "')");
                        for (int i = 0; i < gridView2.RowCount; i++)
                        {
                            gen.ExcuteNonquery("insert into INInwardSUDetail(RefDetailID,RefID,Quantity,QuantityConvert,SortOrder,InventoryItemID,Description,QuantityExits,QuantityConvertExits,UnitPrice,Amount,DebitAccount,CreditAccount) values(newid(),'" + id + "','" + detail1[i, 1] + "','" + detail1[i, 2] + "'," + i + ",'" + detail1[i, 0] + "',N'" + detail1[i, 3] + "',0,0,'" + detail1[i, 4] + "','" + detail1[i, 5] + "','1563','3313')");
                        }
                    }
                    F.myac();
                    F.getactive("1");
                    F.Text = "Xem phiếu nhập kho Gas";
                }
            }
            catch
            {
                XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#36
0
        /// <summary>
        /// SetEditBackColor 編輯時設置編輯對象背景色
        /// </summary>
        /// <param name="cts"></param>
        /// <param name="_flag"></param>
        public static void SetEditBackColor(Control.ControlCollection cts, bool _flag)
        {
            foreach (Control ct in cts)
            {
                if (ct.Tag == null)
                {
                    ct.Tag = "";
                }
                switch (ct.GetType().Name)
                {
                case "TextBox":
                    TextBox ts0 = (TextBox)ct;
                    if (_flag)
                    {
                        ts0.BackColor = System.Drawing.Color.LemonChiffon;
                        if (ts0.Tag.ToString() == "2")     //非主鍵設爲可編輯狀態
                        {
                            ts0.ReadOnly = false;
                        }
                        if (ts0.Enabled == false)     //設置建檔人,修改人文本框的背景顏色
                        {
                            ts0.BackColor = System.Drawing.Color.White;
                        }
                    }
                    else
                    {
                        ts0.BackColor = System.Drawing.Color.White; //.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
                        if (ts0.Tag.ToString() == "2")              //非主鍵設爲不可編輯狀態
                        {
                            ts0.ReadOnly = true;
                        }
                        if (ts0.Tag.ToString() == "1")     //主鍵設爲可編輯狀態
                        {
                            ts0.ReadOnly = false;
                        }
                    }
                    break;

                case "TextEdit":
                    TextEdit ts1 = (TextEdit)ct;
                    if (_flag)
                    {
                        ts1.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        if (ts1.Tag.ToString() == "2")     //非主鍵設爲可編輯狀態
                        {
                            ts1.Properties.ReadOnly = false;
                        }
                        if (ts1.Enabled == false)     //設置建檔人,修改人文本框的背景顏色
                        {
                            ts1.BackColor = System.Drawing.Color.White;
                        }
                    }
                    else
                    {
                        ts1.Properties.Appearance.BackColor = System.Drawing.Color.White; //.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
                        if (ts1.Tag.ToString() == "2")                                    //非主鍵設爲不可編輯狀態
                        {
                            ts1.Properties.ReadOnly = true;
                        }
                        if (ts1.Tag.ToString() == "1")     //主鍵設爲可編輯狀態
                        {
                            ts1.Properties.ReadOnly = false;
                        }
                    }
                    break;

                case "ButtonEdit":
                    ButtonEdit ts7 = (ButtonEdit)ct;
                    if (_flag)
                    {
                        ts7.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        if (ts7.Tag.ToString() == "2")     //非主鍵設爲可編輯狀態
                        {
                            ts7.Properties.ReadOnly = false;
                        }
                        if (ts7.Enabled == false)     //設置建檔人,修改人文本框的背景顏色
                        {
                            ts7.BackColor = System.Drawing.Color.White;
                        }
                    }
                    else
                    {
                        ts7.Properties.Appearance.BackColor = System.Drawing.Color.White; //.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
                        if (ts7.Tag.ToString() == "2")                                    //非主鍵設爲不可編輯狀態
                        {
                            ts7.Properties.ReadOnly = true;
                        }
                        if (ts7.Tag.ToString() == "1")     //主鍵設爲可編輯狀態
                        {
                            ts7.Properties.ReadOnly = false;
                        }
                    }
                    break;

                case "CheckEdit":
                    CheckEdit ts2 = (CheckEdit)ct;
                    if (_flag)
                    {
                        ts2.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        ts2.Enabled = true;
                    }
                    else
                    {
                        ts2.Properties.Appearance.BackColor = System.Drawing.Color.Transparent;
                        ts2.Enabled = false;
                    }
                    break;

                case "MemoEdit":
                    MemoEdit ts3 = (MemoEdit)ct;
                    if (_flag)
                    {
                        ts3.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        ts3.Properties.ReadOnly             = false;
                    }
                    else
                    {
                        ts3.Properties.Appearance.BackColor = System.Drawing.Color.White;
                        ts3.Properties.ReadOnly             = true;
                    }
                    break;

                case "LookUpEdit":
                    LookUpEdit ts4 = (LookUpEdit)ct;
                    if (_flag)
                    {
                        ts4.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        ts4.Enabled = true;
                    }
                    else
                    {
                        ts4.Properties.Appearance.BackColor = System.Drawing.Color.White;
                        ts4.Enabled = false;
                    }
                    break;

                case "DateEdit":
                    DateEdit ts5 = (DateEdit)ct;
                    if (_flag)
                    {
                        ts5.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        ts5.Enabled = true;
                    }
                    else
                    {
                        ts5.Properties.Appearance.BackColor = System.Drawing.Color.White;
                        ts5.Enabled = false;
                    }
                    break;

                case "RichTextBox":
                    RichTextBox ts6 = (RichTextBox)ct;
                    if (_flag)
                    {
                        ts6.BackColor = System.Drawing.Color.LemonChiffon;
                        ts6.ReadOnly  = false;
                    }
                    else
                    {
                        ts6.BackColor = System.Drawing.Color.White;
                        ts6.ReadOnly  = true;
                    }
                    break;

                case "MaskedTextBox":
                    MaskedTextBox ts8 = (MaskedTextBox)ct;
                    if (_flag)
                    {
                        ts8.BackColor = System.Drawing.Color.LemonChiffon;
                        ts8.ReadOnly  = false;
                    }
                    else
                    {
                        ts8.BackColor = System.Drawing.Color.White;
                        ts8.ReadOnly  = true;
                    }
                    break;

                case "ComboBox":
                    System.Windows.Forms.ComboBox ts9 = (System.Windows.Forms.ComboBox)ct;
                    if (_flag)
                    {
                        ts9.BackColor = System.Drawing.Color.LemonChiffon;
                        ts9.Enabled   = true;
                    }
                    else
                    {
                        ts9.BackColor = System.Drawing.Color.White;
                        ts9.Enabled   = false;
                    }
                    break;

                case "ComboBoxEdit":
                    ComboBoxEdit ts10 = (ComboBoxEdit)ct;
                    if (_flag)
                    {
                        ts10.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        ts10.Enabled = true;
                    }
                    else
                    {
                        ts10.Properties.Appearance.BackColor = System.Drawing.Color.White;
                        ts10.Enabled = false;
                    }
                    break;

                case "SpinEdit":
                    SpinEdit ts11 = (SpinEdit)ct;
                    if (_flag)
                    {
                        ts11.Properties.Appearance.BackColor = System.Drawing.Color.LemonChiffon;
                        ts11.Enabled = true;
                    }
                    else
                    {
                        ts11.Properties.Appearance.BackColor = System.Drawing.Color.White;
                        ts11.Enabled = false;
                    }
                    break;

                default:
                    break;
                }
                if (ct.HasChildren) //容器對象時繼續遞規查找
                {
                    SetEditBackColor(ct.Controls, _flag);
                }
            }
        }
示例#37
0
        public void loadpnhbtl(string active, string role, DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, TextEdit txtsct, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                               DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit mahang, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluong, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit soluongqd, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit dongia, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit chiphi, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit thanhtien, Frm_phieunhaphangbantralai F, LookUpEdit ledt, TextEdit txtldn,
                               ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, string tsbt, TextEdit txtshd, TextEdit txtkhhd, TextEdit txtnhd, TextEdit txtcth, TextEdit txtthue, string userid, string branchid, TextEdit txtms, ComboBoxEdit cbthue, ButtonEdit bthd, CheckEdit ckhd, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, DataTable khach, DataTable hang)
        {
            DataTable dt = new DataTable();

            loadstart(gridControl1, gridView1, ledv, denct, denht, mahang, soluong, soluongqd, dongia, chiphi, thanhtien, ledt, tsbtsua, tsbtxoa, tsbtcat, tsbtboghi, tsbtghiso, tsbtnap, tsbtin, ngaychungtu, dt, tsbt, userid, cbthue, khach, hang);
            if (active == "1")
            {
                tsbtcat.Enabled = false;
                DataTable da = new DataTable();

                F.Text = "Xem phiếu nhập hàng bán trả lại";
                da     = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,Tax,InvDate,InvSeries,InvNo,No,RefIn,CheckIn,TotalVATAmount  from INReInward a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + role + "'");


                ledv.EditValue = da.Rows[0][7].ToString();
                ledt.EditValue = da.Rows[0][0].ToString();
                F.gethd(da.Rows[0][16].ToString());
                txtldn.Text      = da.Rows[0][2].ToString();
                bthd.EditValue   = da.Rows[0][16].ToString();
                denct.EditValue  = DateTime.Parse(da.Rows[0][4].ToString());
                denht.EditValue  = DateTime.Parse(da.Rows[0][5].ToString());
                txtsct.EditValue = da.Rows[0][6].ToString();
                cbthue.EditValue = da.Rows[0][11].ToString();
                Double Tienthue = Double.Parse(da.Rows[0][18].ToString());

                if (da.Rows[0][17].ToString() == "True")
                {
                    ckhd.Checked = true;
                    try
                    {
                        txtnhd.EditValue = DateTime.Parse(da.Rows[0][12].ToString());
                    }
                    catch { txtnhd.Text = ""; }
                    txtshd.Text  = da.Rows[0][14].ToString();
                    txtms.Text   = da.Rows[0][15].ToString();
                    txtkhhd.Text = da.Rows[0][13].ToString();
                }
                if (da.Rows[0][8].ToString() == "True")
                {
                    tsbtghiso.Visible = false;
                    tsbtboghi.Visible = true;
                    tsbtsua.Enabled   = false;
                }
                else
                {
                    tsbtboghi.Visible = false;
                    tsbtghiso.Visible = true;
                }
                if (da.Rows[0][10].ToString() == "True")
                {
                    tsbtboghi.Enabled = false;
                    tsbtghiso.Enabled = false;
                }

                da = gen.GetTable("select  Amount,InventoryItemCode,a.UnitPrice,a.UnitPriceCost,Quantity,QuantityConvert from INReInwardDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + role + "' order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    for (int j = 0; j < gridView1.RowCount; j++)
                    {
                        if (gridView1.GetRowCellValue(j, "Mã hàng").ToString() == da.Rows[i][1].ToString())
                        {
                            gridView1.SetRowCellValue(j, gridView1.Columns["Thành tiền"], da.Rows[i][0].ToString());
                            gridView1.SetRowCellValue(j, gridView1.Columns["Số lượng"], da.Rows[i][4].ToString());
                            gridView1.SetRowCellValue(j, gridView1.Columns["Số lượng quy đổi"], da.Rows[i][5].ToString());
                            gridView1.SetRowCellValue(j, gridView1.Columns["Đơn giá"], da.Rows[i][2].ToString());
                            gridView1.SetRowCellValue(j, gridView1.Columns["Đơn giá phí"], da.Rows[i][3].ToString());
                        }
                    }
                }

                txtcth.Text  = gridView1.Columns["Thành tiền"].SummaryText;
                txtthue.Text = String.Format("{0:n0}", Tienthue);
                checktruocsau(tsbttruoc, tsbtsau, ledv.EditValue.ToString(), txtsct.Text, ngaychungtu);
            }
            else
            {
                try
                {
                    F.Text = "Thêm phiếu nhập hàng bán trả lại";
                    if (role == null)
                    {
                        ledv.ItemIndex = 0;
                    }
                    else
                    {
                        ledv.EditValue = role;
                    }
                    denct.EditValue  = DateTime.Parse(ngaychungtu);
                    denht.EditValue  = DateTime.Parse(ngaychungtu);
                    txtnhd.EditValue = DateTime.Parse(ngaychungtu);
                    txtcth.Text      = gridView1.Columns["Thành tiền"].SummaryText;
                }
                catch
                {
                    XtraMessageBox.Show("Vui lòng kiểm tra lại < Ngày chứng từ >.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    F.Close();
                }
            }
        }
示例#38
0
        /// <summary>
        /// 新增時清除  1.清空全部;2.清空主檔
        /// </summary>
        /// <param name="cts"></param>
        /// <param name="_type"></param>
        public static void ClearObjValue(Control.ControlCollection cts, string _type)
        {
            //新增時清除  2.清空全部;1.清空主檔
            foreach (Control ct in cts)
            {
                if (ct.Tag == null)
                {
                    ct.Tag = "";
                }
                switch (ct.GetType().Name)
                {
                case "TextBox":
                    TextBox ts0 = (TextBox)ct;
                    if (ts0.Tag.ToString() == "N")
                    {
                        ts0.Text = "0";     //數值的預設爲0,不然插入數據庫出會出錯
                    }
                    else
                    {
                        ts0.Text = "";
                    }
                    break;

                case "TextEdit":
                    TextEdit ts1 = (TextEdit)ct;
                    if (ts1.Tag.ToString() == "N")
                    {
                        ts1.Text = "0";     //數值的預設爲0,不然插入數據庫出會出錯
                    }
                    else
                    {
                        ts1.Text = "";
                    }
                    break;

                case "CheckEdit":
                    CheckEdit ts2 = (CheckEdit)ct;
                    ts2.Checked = false;
                    break;

                case "DataGridView":
                    if (_type == "2")     //2.清空全部;1.清空主檔
                    {
                        DataGridView ts3 = (DataGridView)ct;
                        ts3.DataSource = null;
                    }
                    break;

                case "GridControl":
                    if (_type == "2")     //2.清空全部;1.清空主檔
                    {
                        GridControl ts4 = (GridControl)ct;
                        ts4.DataSource = null;
                    }
                    break;

                case "MemoEdit":
                    MemoEdit ts5 = (MemoEdit)ct;
                    ts5.Text = "";
                    break;

                case "LookUpEdit":
                    LookUpEdit ts6 = (LookUpEdit)ct;
                    ts6.EditValue = "";
                    break;

                case "DateEdit":
                    DateEdit ts7 = (DateEdit)ct;
                    ts7.EditValue = "";
                    break;

                case "PictureBox":
                    PictureBox ts8 = (PictureBox)ct;
                    ts8.Image = null;
                    break;

                case "ButtonEdit":
                    ButtonEdit ts9 = (ButtonEdit)ct;
                    ts9.Text = "";
                    break;

                case "RichTextBox":
                    RichTextBox ts10 = (RichTextBox)ct;
                    ts10.Text = "";
                    break;

                case "MaskedTextBox":
                    MaskedTextBox ts11 = (MaskedTextBox)ct;
                    ts11.Text = "";
                    break;

                case "ComboBox":
                    System.Windows.Forms.ComboBox ts12 = (System.Windows.Forms.ComboBox)ct;
                    ts12.Text = "";
                    break;

                case "SpinEdit":
                    SpinEdit ts13 = (SpinEdit)ct;
                    ts13.EditValue = "";
                    break;

                default:
                    break;
                }
                if (ct.HasChildren) //容器對象時繼續遞規查找
                {
                    ClearObjValue(ct.Controls, _type);
                }
            }
        }
示例#39
0
        private void CheckControl(object control)
        {
            DateEdit   dateEdit   = null;
            TextEdit   textEdit   = null;
            LookUpEdit lookUpEdit = null;
            MemoEdit   memoEdit   = null;

            try
            {
                if (control.ToString().Equals("DevExpress.XtraEditors.DateEdit"))
                {
                    dateEdit = control as DateEdit;
                    if (dateEdit.Tag == null)
                    {
                        return;
                    }
                    if (dateEdit.Tag.Equals(0) && !ckIsReturn.Checked)
                    {
                        return;
                    }
                    if (dateEdit.EditValue != null)
                    {
                        return;
                    }

                    dateEdit.ErrorText = "Огноо оруулна уу.";
                    if (isActionProgress)
                    {
                        return;
                    }
                    dateEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.TextEdit"))
                {
                    textEdit = control as TextEdit;
                    if (!string.IsNullOrEmpty(textEdit.Text))
                    {
                        return;
                    }

                    textEdit.ErrorText = textEdit.Tag.ToString();
                    if (isActionProgress)
                    {
                        return;
                    }
                    textEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.LookUpEdit"))
                {
                    lookUpEdit = control as LookUpEdit;
                    if (lookUpEdit.Tag == null)
                    {
                        return;
                    }
                    if (lookUpEdit.EditValue != null)
                    {
                        return;
                    }

                    if (lookUpEdit.Tag.Equals(0))
                    {
                        lookUpEdit.ErrorText = "Алба/газар оруулна уу.";
                    }
                    else if (lookUpEdit.Tag.Equals(1))
                    {
                        lookUpEdit.ErrorText = "Байршил тодорхойлно уу.";
                    }
                    else
                    {
                        lookUpEdit.ErrorText = lookUpEdit.Tag.ToString();
                    }

                    if (isActionProgress)
                    {
                        return;
                    }
                    lookUpEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
                else if (control.ToString().Equals("DevExpress.XtraEditors.MemoEdit"))
                {
                    memoEdit = control as MemoEdit;
                    if (!string.IsNullOrEmpty(memoEdit.Text))
                    {
                        return;
                    }

                    memoEdit.ErrorText = memoEdit.Tag.ToString();
                    if (isActionProgress)
                    {
                        return;
                    }
                    memoEdit.Focus();
                    isActionProgress = !isActionProgress;
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Контрол шалгахад алдаа гарлаа: " + ex.InnerException.Message);
                throw new MofException("Контрол шалгахад алдаа гарлаа!", ex);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Контрол шалгахад алдаа гарлаа: " + ex.Message);
                throw new MofException("Контрол шалгахад алдаа гарлаа!", ex);
            }
            finally { dateEdit = null; textEdit = null; lookUpEdit = null; memoEdit = null; }
        }
 public CustomPopupDateEditForm(DateEdit de) : base(de)
 {
 }
示例#41
0
 /// <summary>
 /// 绑定日期选择控件(DateEdit)的EditValueChanged事件.
 /// 原因请叁考OnDateEditValueChange方法描述.
 /// </summary>
 public static void BindingDateEditValueChangeEvent(DateEdit dateEdit)
 {
     dateEdit.EditValueChanged += new EventHandler(OnDateEditValueChange);
 }
示例#42
0
        /// <summary>
        /// 初始化界面如果遇到非法的创建控件则跳过此空间不创建
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Value"></param>
        /// <param name="ControlType"></param>
        /// <param name="DicNo"></param>
        private void InitControls(Int32 ID, string Name, string Value, Int16 ControlType, Int32 DicNo, Int32 Numlen)
        {
            xscControls.SuspendLayout();
            // 是否成功创建控件
            bool                _createControl = true;
            LabelControl        lc             = new LabelControl();
            TextEdit            te             = null;
            ComboBoxEdit        cbb            = null;
            CheckedComboBoxEdit ccbb           = null;
            CheckEdit           ck             = null;
            DateEdit            de             = null;
            TimeEdit            time           = null;

            try {
                lc.Width        = Const.LabelControlWidth;
                lc.Height       = Const.LabelControlHeight;
                lc.Text         = Name + Const.Colon;
                lc.Left         = _currPosition_X;
                lc.Top          = _currPosition_Y;
                lc.AutoSizeMode = LabelAutoSizeMode.None;
                lc.Appearance.TextOptions.HAlignment = HorzAlignment.Far;
                lc.Name = string.Format("lbl{0}", ID);

                _currPosition_X = _currPosition_X + lc.Width + Const.ControlInterval;

                switch (ControlType)
                {
                case 0:
                    #region 文本控件
                    te = new TextEdit();
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).BeginInit();
                    te.Width    = Const.TextEditWidth;
                    te.Height   = Const.TextEditHeight;
                    te.Text     = Value;
                    te.Left     = _currPosition_X;
                    te.Top      = _currPosition_Y + Const.Three;
                    te.Tag      = Name;            // 控件的tag 保存其中文名
                    te.TabIndex = ID;              // 控件的TabIndex 保存其数据库中的ID
                    te.Name     = string.Format("ctl{0}", ID);

                    te.Enter += (sender, e) =>
                    {
                        _beforeStr = (sender as TextEdit).Text;
                    };
                    te.Leave += (sender, e) =>
                    {
                        var c = sender as TextEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.Text;
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).EndInit();
                    #endregion
                    break;

                case 1:
                    #region 整数控件
                    te = new TextEdit();
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).BeginInit();
                    te.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;
                    te.Properties.Mask.EditMask = "[0-9]*";
                    te.Properties.Mask.UseMaskAsDisplayFormat = true;
                    te.Width    = Const.TextEditWidth;
                    te.Height   = Const.TextEditHeight;
                    te.Text     = Value;
                    te.Left     = _currPosition_X;
                    te.Top      = _currPosition_Y + Const.Three;
                    te.Tag      = Name;            // 控件的tag 保存其中文名
                    te.TabIndex = ID;              // 控件的TabIndex 保存其数据库中的ID
                    te.Name     = string.Format("ctl{0}", ID);
                    if (Numlen > 0)
                    {
                        te.Properties.MaxLength = Numlen;
                    }

                    te.Enter += (sender, e) =>
                    {
                        _beforeStr = (sender as TextEdit).Text;
                    };
                    te.Leave += (sender, e) =>
                    {
                        var c = sender as TextEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.Text;
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).EndInit();
                    #endregion
                    break;

                case 2:
                    #region 单选下拉框
                    cbb = new ComboBoxEdit();
                    ((System.ComponentModel.ISupportInitialize)(cbb.Properties)).BeginInit();
                    cbb.Width  = Const.TextEditWidth;
                    cbb.Height = Const.TextEditHeight;
                    cbb.Name   = string.Format("ctl{0}", ID);
                    cbb.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
                    cbb.BindDictItems(DicNo);
                    if (!string.IsNullOrEmpty(Value))
                    {
                        cbb.SetComboBoxItem(Convert.ToInt32(Value));
                    }
                    cbb.Left     = _currPosition_X;
                    cbb.Top      = _currPosition_Y + Const.Three;
                    cbb.Tag      = Name;
                    cbb.TabIndex = ID;
                    cbb.Enter   += (sender, e) =>
                    {
                        _beforeStr = (sender as ComboBoxEdit).GetComboBoxIntValue().ToString();
                    };
                    cbb.Leave += (sender, e) =>
                    {
                        var c = sender as ComboBoxEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.GetComboBoxIntValue().ToString();

                        if (currStr == Const.NoSeletValue.ToString())
                        {
                            currStr = string.Empty;
                        }

                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(cbb.Properties)).EndInit();
                    #endregion
                    break;

                case 3:
                    #region 多选下拉框
                    ccbb = new CheckedComboBoxEdit();
                    ((System.ComponentModel.ISupportInitialize)(ccbb.Properties)).BeginInit();
                    ccbb.Width  = Const.TextEditWidth;
                    ccbb.Height = Const.TextEditHeight;
                    ccbb.Name   = string.Format("ctl{0}", ID);
                    ccbb.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
                    ccbb.BindDictItems(DicNo);
                    ccbb.SetComboBoxItem(Value);
                    ccbb.Left     = _currPosition_X;
                    ccbb.Top      = _currPosition_Y + Const.Three;
                    ccbb.Tag      = Name;
                    ccbb.TabIndex = ID;
                    ccbb.Enter   += (sender, e) =>
                    {
                        _beforeStr = (sender as CheckedComboBoxEdit).GetCheckedComboBoxValue();
                    };
                    ccbb.Leave += (sender, e) =>
                    {
                        var c = sender as CheckedComboBoxEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.GetCheckedComboBoxValue();

                        if (currStr == Const.NoSeletValue.ToString())
                        {
                            currStr = string.Empty;
                        }

                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(ccbb.Properties)).EndInit();
                    #endregion
                    break;

                case 4:
                    #region 勾选框
                    ck = new CheckEdit();
                    ((System.ComponentModel.ISupportInitialize)(ck.Properties)).BeginInit();

                    ck.Width              = Const.TextEditWidth;
                    ck.Height             = Const.TextEditHeight;
                    ck.Checked            = Value == Convert.ToString(Const.One) ? true : false;
                    ck.Left               = _currPosition_X;
                    ck.Top                = _currPosition_Y + Const.Three;
                    ck.Tag                = Name;  // 控件的tag 保存其中文名
                    ck.TabIndex           = ID;    // 控件的TabIndex 保存其数据库中的ID
                    ck.Name               = string.Format("ctl{0}", ID);
                    ck.Text               = string.Empty;
                    ck.EditValueChanging += (sender, e) =>
                    {
                        _beforeStr = (sender as CheckEdit).Checked ? "1" : "0";
                    };
                    ck.EditValueChanged += (sender, e) =>
                    {
                        var c = sender as CheckEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = (sender as CheckEdit).Checked ? "1" : "0";
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(ck.Properties)).EndInit();
                    #endregion
                    break;

                case 5:
                    #region 日期
                    de = new DateEdit();
                    ((System.ComponentModel.ISupportInitialize)(de.Properties.CalendarTimeProperties)).BeginInit();
                    ((System.ComponentModel.ISupportInitialize)(de.Properties)).BeginInit();
                    de.Width  = Const.TextEditWidth;
                    de.Height = Const.TextEditHeight;
                    if (!string.IsNullOrEmpty(Value))
                    {
                        de.SetDateTime(Convert.ToDateTime(Value));
                    }
                    de.Left     = _currPosition_X;
                    de.Top      = _currPosition_Y + Const.Three;
                    de.Tag      = Name;            // 控件的tag 保存其中文名
                    de.TabIndex = ID;              // 控件的TabIndex 保存其数据库中的ID
                    de.Name     = string.Format("ctl{0}", ID);
                    de.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
                    de.Properties.CalendarTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
                    de.Properties.DisplayFormat.FormatString = Const.DateformatString;
                    de.Properties.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
                    de.Properties.EditFormat.FormatString    = Const.DateformatString;
                    de.Properties.EditFormat.FormatType      = DevExpress.Utils.FormatType.DateTime;
                    de.Properties.Mask.EditMask = Const.DateformatString;
                    de.EditValueChanging       += (sender, e) =>
                    {
                        _beforeStr = (sender as DateEdit).GetDateTimeString();
                    };
                    de.EditValueChanged += (sender, e) =>
                    {
                        var c = sender as DateEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = (sender as DateEdit).GetDateTimeString();
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(de.Properties.CalendarTimeProperties)).EndInit();
                    ((System.ComponentModel.ISupportInitialize)(de.Properties)).EndInit();
                    #endregion
                    break;

                case 6:
                    #region 密码
                    te = new TextEdit();
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).BeginInit();
                    te.Width    = Const.TextEditWidth;
                    te.Height   = Const.TextEditHeight;
                    te.Text     = Value;
                    te.Left     = _currPosition_X;
                    te.Top      = _currPosition_Y + Const.Three;
                    te.Tag      = Name;            // 控件的tag 保存其中文名
                    te.TabIndex = ID;              // 控件的TabIndex 保存其数据库中的ID
                    te.Properties.PasswordChar = '*';
                    te.Name = string.Format("ctl{0}", ID);

                    te.Enter += (sender, e) =>
                    {
                        _beforeStr = (sender as TextEdit).Text;
                    };
                    te.Leave += (sender, e) =>
                    {
                        var c = sender as TextEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.Text;
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).EndInit();
                    #endregion
                    break;

                case 7:
                    #region 小数框
                    te = new TextEdit();
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).BeginInit();
                    te.Properties.Mask.EditMask = string.Format("f{0}", Numlen);
                    te.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                    te.Width    = Const.TextEditWidth;
                    te.Height   = Const.TextEditHeight;
                    te.Text     = Value;
                    te.Left     = _currPosition_X;
                    te.Top      = _currPosition_Y + Const.Three;
                    te.Tag      = Name;            // 控件的tag 保存其中文名
                    te.TabIndex = ID;              // 控件的TabIndex 保存其数据库中的ID
                    te.Name     = string.Format("ctl{0}", ID);

                    te.Enter += (sender, e) =>
                    {
                        _beforeStr = (sender as TextEdit).Text;
                    };
                    te.Leave += (sender, e) =>
                    {
                        var c = sender as TextEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.Text;
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(te.Properties)).EndInit();
                    #endregion
                    break;

                case 8:
                    #region 时间框
                    time = new TimeEdit();
                    ((System.ComponentModel.ISupportInitialize)(time.Properties)).BeginInit();
                    time.Width  = Const.TextEditWidth;
                    time.Height = Const.TextEditHeight;
                    if (!string.IsNullOrEmpty(Value))
                    {
                        time.SetTime(Convert.ToDateTime(Value));
                    }
                    time.Left     = _currPosition_X;
                    time.Top      = _currPosition_Y + Const.Three;
                    time.Tag      = Name;            // 控件的tag 保存其中文名
                    time.TabIndex = ID;              // 控件的TabIndex 保存其数据库中的ID
                    time.Name     = string.Format("ctl{0}", ID);
                    time.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });

                    time.Enter += (sender, e) =>
                    {
                        _beforeStr = (sender as TimeEdit).GetTimeString();
                    };
                    time.Leave += (sender, e) =>
                    {
                        var c = sender as TimeEdit;
                        if (c == null)
                        {
                            return;
                        }
                        string currStr = c.GetTimeString();
                        // 此文本框有修改
                        if (!string.Equals(currStr, _beforeStr))
                        {
                            if (MeEvent != null)
                            {
                                MeEvent(string.Format("系统参数[{0}]-{1} 修改前:{2} → 修改后:{3}", c.TabIndex, c.Tag, _beforeStr, currStr));
                            }
                            _beforeStr = string.Empty;
                        }
                        SetInfo(c.TabIndex, _SysId, currStr);
                    };
                    ((System.ComponentModel.ISupportInitialize)(time.Properties)).EndInit();
                    #endregion
                    break;
                }
                _currPosition_X = _currPosition_X + Const.TextEditWidth + Const.InfoInterval;

                // 如果屏幕宽度不够则换到下一行
                if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - 200 < _currPosition_X + Const.TextEditWidth + Const.InfoInterval)
                {
                    _currPosition_X = 0;
                    _currPosition_Y = _currPosition_Y + Const.Position_Y;
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogLevel.LOG_LEVEL_CRIT, ex, typeof(FrmSysparameter));
                _createControl  = false;
                _currPosition_X = _currPosition_X - lc.Width - Const.ControlInterval;
            }

            if (te == null && cbb == null && ccbb == null && ck == null && de == null && time == null)
            {
                _createControl = false;
            }

            if (_createControl)
            {
                xscControls.Controls.Add(lc);
                if (te != null)
                {
                    xscControls.Controls.Add(te);
                }
                if (cbb != null)
                {
                    xscControls.Controls.Add(cbb);
                }
                if (ccbb != null)
                {
                    xscControls.Controls.Add(ccbb);
                }
                if (ck != null)
                {
                    xscControls.Controls.Add(ck);
                }
                if (de != null)
                {
                    xscControls.Controls.Add(de);
                }
                if (time != null)
                {
                    xscControls.Controls.Add(time);
                }
            }
            xscControls.ResumeLayout(false);
        }
 public MyVistaPopupDateEditForm(DateEdit ownerEdit) : base(ownerEdit)
 {
 }
示例#44
0
 private void InitializeComponent()
 {
     this.chb_selDate = new CheckBox();
     this.Btn_Yes = new SimpleButton();
     this.groupBox2 = new GroupBox();
     this.label11 = new Label();
     this.Fdate = new DateEdit();
     this.Odate = new DateEdit();
     this.label12 = new Label();
     this.groupBox1 = new GroupBox();
     this.cmb_Sfwtlp = new ComboBoxEdit();
     this.label1 = new Label();
     this.label10 = new Label();
     this.label9 = new Label();
     this.txt_PId = new TextEdit();
     this.txt_zrlx = new TextEdit();
     this.label8 = new Label();
     this.txt_zrfs = new TextEdit();
     this.label6 = new Label();
     this.txt_fdczl = new TextEdit();
     this.label7 = new Label();
     this.label5 = new Label();
     this.txt_zrf = new TextEdit();
     this.txt_zq = new TextEdit();
     this.label2 = new Label();
     this.txt_srf = new TextEdit();
     this.txt_tdyt = new TextEdit();
     this.txt_fwyt = new TextEdit();
     this.label4 = new Label();
     this.label3 = new Label();
     this.groupBox2.SuspendLayout();
     this.Fdate.Properties.BeginInit();
     this.Odate.Properties.BeginInit();
     this.groupBox1.SuspendLayout();
     this.cmb_Sfwtlp.Properties.BeginInit();
     this.txt_PId.Properties.BeginInit();
     this.txt_zrlx.Properties.BeginInit();
     this.txt_zrfs.Properties.BeginInit();
     this.txt_fdczl.Properties.BeginInit();
     this.txt_zrf.Properties.BeginInit();
     this.txt_zq.Properties.BeginInit();
     this.txt_srf.Properties.BeginInit();
     this.txt_tdyt.Properties.BeginInit();
     this.txt_fwyt.Properties.BeginInit();
     base.SuspendLayout();
     this.chb_selDate.AutoSize = true;
     this.chb_selDate.Location = new Point(0x15, 0xdb);
     this.chb_selDate.Name = "chb_selDate";
     this.chb_selDate.Size = new Size(0x54, 0x10);
     this.chb_selDate.TabIndex = 30;
     this.chb_selDate.Text = "按日期查询";
     this.chb_selDate.UseVisualStyleBackColor = true;
     this.Btn_Yes.ButtonStyle = BorderStyles.Office2003;
     this.Btn_Yes.Location = new Point(0x111, 0x127);
     this.Btn_Yes.Name = "Btn_Yes";
     this.Btn_Yes.Size = new Size(0x4b, 0x17);
     this.Btn_Yes.TabIndex = 0x20;
     this.Btn_Yes.Text = "统计";
     this.Btn_Yes.Click += new EventHandler(this.Btn_Yes_Click);
     this.groupBox2.Controls.Add(this.label11);
     this.groupBox2.Controls.Add(this.Fdate);
     this.groupBox2.Controls.Add(this.Odate);
     this.groupBox2.Controls.Add(this.label12);
     this.groupBox2.Location = new Point(15, 0xe7);
     this.groupBox2.Name = "groupBox2";
     this.groupBox2.Size = new Size(0x251, 0x3a);
     this.groupBox2.TabIndex = 0x1f;
     this.groupBox2.TabStop = false;
     this.label11.AutoSize = true;
     this.label11.Location = new Point(10, 0x1a);
     this.label11.Name = "label11";
     this.label11.Size = new Size(0x41, 12);
     this.label11.TabIndex = 0x16;
     this.label11.Text = "收件日期:";
     this.Fdate.EditValue = new DateTime(0x7d6, 7, 0x19, 0, 0, 0, 0);
     this.Fdate.Location = new Point(0x51, 20);
     this.Fdate.Name = "Fdate";
     this.Fdate.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
     this.Fdate.Size = new Size(0x99, 0x17);
     this.Fdate.TabIndex = 0x15;
     this.Odate.EditValue = new DateTime(0x7d6, 7, 0x19, 0, 0, 0, 0);
     this.Odate.Location = new Point(0x113, 20);
     this.Odate.Name = "Odate";
     this.Odate.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
     this.Odate.Size = new Size(0x99, 0x17);
     this.Odate.TabIndex = 0x16;
     this.label12.AutoSize = true;
     this.label12.Location = new Point(240, 0x1a);
     this.label12.Name = "label12";
     this.label12.Size = new Size(0x1d, 12);
     this.label12.TabIndex = 0x17;
     this.label12.Text = " 至 ";
     this.groupBox1.Controls.Add(this.cmb_Sfwtlp);
     this.groupBox1.Controls.Add(this.label1);
     this.groupBox1.Controls.Add(this.label10);
     this.groupBox1.Controls.Add(this.label9);
     this.groupBox1.Controls.Add(this.txt_PId);
     this.groupBox1.Controls.Add(this.txt_zrlx);
     this.groupBox1.Controls.Add(this.label8);
     this.groupBox1.Controls.Add(this.txt_zrfs);
     this.groupBox1.Controls.Add(this.label6);
     this.groupBox1.Controls.Add(this.txt_fdczl);
     this.groupBox1.Controls.Add(this.label7);
     this.groupBox1.Controls.Add(this.label5);
     this.groupBox1.Controls.Add(this.txt_zrf);
     this.groupBox1.Controls.Add(this.txt_zq);
     this.groupBox1.Controls.Add(this.label2);
     this.groupBox1.Controls.Add(this.txt_srf);
     this.groupBox1.Controls.Add(this.txt_tdyt);
     this.groupBox1.Controls.Add(this.txt_fwyt);
     this.groupBox1.Controls.Add(this.label4);
     this.groupBox1.Controls.Add(this.label3);
     this.groupBox1.Location = new Point(15, 13);
     this.groupBox1.Name = "groupBox1";
     this.groupBox1.Size = new Size(0x251, 190);
     this.groupBox1.TabIndex = 0x1d;
     this.groupBox1.TabStop = false;
     this.cmb_Sfwtlp.Location = new Point(0x65, 0x9c);
     this.cmb_Sfwtlp.Name = "cmb_Sfwtlp";
     this.cmb_Sfwtlp.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
     this.cmb_Sfwtlp.Properties.Items.AddRange(new object[] { "是", "否" });
     this.cmb_Sfwtlp.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
     this.cmb_Sfwtlp.Size = new Size(100, 0x17);
     this.cmb_Sfwtlp.TabIndex = 0x15;
     this.label1.AutoSize = true;
     this.label1.Location = new Point(0x12, 0x11);
     this.label1.Name = "label1";
     this.label1.Size = new Size(0x35, 12);
     this.label1.TabIndex = 0;
     this.label1.Text = "业务号:";
     this.label10.AutoSize = true;
     this.label10.Location = new Point(0x12, 0x2e);
     this.label10.Name = "label10";
     this.label10.Size = new Size(0x35, 12);
     this.label10.TabIndex = 0x13;
     this.label10.Text = "转让方:";
     this.label9.AutoSize = true;
     this.label9.Location = new Point(6, 0xa2);
     this.label9.Name = "label9";
     this.label9.Size = new Size(0x59, 12);
     this.label9.TabIndex = 0x12;
     this.label9.Text = "是否问题楼盘:";
     this.txt_PId.Location = new Point(0x4d, 11);
     this.txt_PId.Name = "txt_PId";
     this.txt_PId.Size = new Size(0xcd, 0x17);
     this.txt_PId.TabIndex = 1;
     this.txt_zrlx.Location = new Point(0x4d, 0x62);
     this.txt_zrlx.Name = "txt_zrlx";
     this.txt_zrlx.Size = new Size(0xcd, 0x17);
     this.txt_zrlx.TabIndex = 5;
     this.label8.AutoSize = true;
     this.label8.Location = new Point(0x143, 0x11);
     this.label8.Name = "label8";
     this.label8.Size = new Size(0x29, 12);
     this.label8.TabIndex = 0x11;
     this.label8.Text = "镇区:";
     this.txt_zrfs.EditValue = "";
     this.txt_zrfs.Location = new Point(370, 0x62);
     this.txt_zrfs.Name = "txt_zrfs";
     this.txt_zrfs.Size = new Size(0xcd, 0x17);
     this.txt_zrfs.TabIndex = 7;
     this.label6.AutoSize = true;
     this.label6.Location = new Point(0x12b, 0x68);
     this.label6.Name = "label6";
     this.label6.Size = new Size(0x41, 12);
     this.label6.TabIndex = 15;
     this.label6.Text = "转让方式:";
     this.txt_fdczl.Location = new Point(0x5b, 0x7f);
     this.txt_fdczl.Name = "txt_fdczl";
     this.txt_fdczl.Size = new Size(0x1e4, 0x17);
     this.txt_fdczl.TabIndex = 3;
     this.label7.AutoSize = true;
     this.label7.Location = new Point(8, 0x85);
     this.label7.Name = "label7";
     this.label7.Size = new Size(0x4d, 12);
     this.label7.TabIndex = 0x10;
     this.label7.Text = "房地产座落:";
     this.label5.AutoSize = true;
     this.label5.Location = new Point(8, 0x68);
     this.label5.Name = "label5";
     this.label5.Size = new Size(0x41, 12);
     this.label5.TabIndex = 14;
     this.label5.Text = "转让类型:";
     this.txt_zrf.Location = new Point(0x4d, 40);
     this.txt_zrf.Name = "txt_zrf";
     this.txt_zrf.Size = new Size(0xcd, 0x17);
     this.txt_zrf.TabIndex = 2;
     this.txt_zq.Location = new Point(370, 11);
     this.txt_zq.Name = "txt_zq";
     this.txt_zq.Properties.ReadOnly = true;
     this.txt_zq.Size = new Size(0xcd, 0x17);
     this.txt_zq.TabIndex = 8;
     this.label2.AutoSize = true;
     this.label2.Location = new Point(0x137, 0x2e);
     this.label2.Name = "label2";
     this.label2.Size = new Size(0x35, 12);
     this.label2.TabIndex = 11;
     this.label2.Text = "受让方:";
     this.txt_srf.Location = new Point(370, 40);
     this.txt_srf.Name = "txt_srf";
     this.txt_srf.Size = new Size(0xcd, 0x17);
     this.txt_srf.TabIndex = 4;
     this.txt_tdyt.Location = new Point(0x4d, 0x45);
     this.txt_tdyt.Name = "txt_tdyt";
     this.txt_tdyt.Size = new Size(0xcd, 0x17);
     this.txt_tdyt.TabIndex = 9;
     this.txt_fwyt.Location = new Point(370, 0x45);
     this.txt_fwyt.Name = "txt_fwyt";
     this.txt_fwyt.Size = new Size(0xcd, 0x17);
     this.txt_fwyt.TabIndex = 10;
     this.label4.AutoSize = true;
     this.label4.Location = new Point(0x12b, 0x4b);
     this.label4.Name = "label4";
     this.label4.Size = new Size(0x41, 12);
     this.label4.TabIndex = 13;
     this.label4.Text = "房屋用途:";
     this.label3.AutoSize = true;
     this.label3.Location = new Point(8, 0x4b);
     this.label3.Name = "label3";
     this.label3.Size = new Size(0x41, 12);
     this.label3.TabIndex = 12;
     this.label3.Text = "土地用途:";
     base.AutoScaleDimensions = new SizeF(6f, 12f);
     base.AutoScaleMode = AutoScaleMode.Font;
     base.Controls.Add(this.chb_selDate);
     base.Controls.Add(this.Btn_Yes);
     base.Controls.Add(this.groupBox2);
     base.Controls.Add(this.groupBox1);
     base.Name = "FDCRSFMXF";
     base.Size = new Size(620, 0x14c);
     base.Load += new EventHandler(this.FDCRSFMXF_Load);
     this.groupBox2.ResumeLayout(false);
     this.groupBox2.PerformLayout();
     this.Fdate.Properties.EndInit();
     this.Odate.Properties.EndInit();
     this.groupBox1.ResumeLayout(false);
     this.groupBox1.PerformLayout();
     this.cmb_Sfwtlp.Properties.EndInit();
     this.txt_PId.Properties.EndInit();
     this.txt_zrlx.Properties.EndInit();
     this.txt_zrfs.Properties.EndInit();
     this.txt_fdczl.Properties.EndInit();
     this.txt_zrf.Properties.EndInit();
     this.txt_zq.Properties.EndInit();
     this.txt_srf.Properties.EndInit();
     this.txt_tdyt.Properties.EndInit();
     this.txt_fwyt.Properties.EndInit();
     base.ResumeLayout(false);
     base.PerformLayout();
 }
示例#45
0
 private void Namhientai(DateEdit tungay, DateEdit denngay)
 {
     DateTime daunam = HelpDate.GetStartOfCurrentYear();
     tungay.EditValue = daunam;
     DateTime cuoinam = HelpDate.GetEndOfCurrentYear();
     denngay.EditValue = cuoinam;
 }
示例#46
0
        public void loadchinhsach(string role, LookUpEdit lencc, LookUpEdit lencs, TextEdit txtscs, DateEdit detn, DateEdit dedn, TextEdit txttsl, TextEdit txtdsl, TextEdit txtck, RadioButton rbthang, RadioButton rbquy, RadioButton rbnam, RadioButton rbkg, RadioButton rbtan, MemoEdit txtnd, LabelControl lauser)
        {
            DataTable dt = gen.GetTable("select PolicyCode,InventoryItemCode,PolicyName,BeginDate,EndDate,Unit,Discount,PolicyParent,Species,BeginQuantity,EndQuantity,UserName from Policy where PolicyID='" + role + "'");

            txtscs.EditValue = dt.Rows[0][0];
            lencc.EditValue  = dt.Rows[0][1];
            txtnd.EditValue  = dt.Rows[0][2];
            detn.EditValue   = dt.Rows[0][3];
            dedn.EditValue   = dt.Rows[0][4];
            if (dt.Rows[0][5].ToString() == "Kg")
            {
                rbkg.Checked = true;
            }
            else if (dt.Rows[0][5].ToString() == "Tấn")
            {
                rbtan.Checked = true;
            }

            txtck.EditValue = double.Parse(dt.Rows[0][6].ToString());
            lencs.EditValue = dt.Rows[0][7];

            if (dt.Rows[0][8].ToString() == "Tháng")
            {
                rbthang.Checked = true;
            }
            else if (dt.Rows[0][8].ToString() == "Quý")
            {
                rbquy.Checked = true;
            }
            else if (dt.Rows[0][8].ToString() == "Năm")
            {
                rbnam.Checked = true;
            }

            txttsl.EditValue = double.Parse(dt.Rows[0][9].ToString());
            txtdsl.EditValue = double.Parse(dt.Rows[0][10].ToString());
            lauser.Text      = dt.Rows[0][11].ToString();
        }
示例#47
0
 // Ngày đầu năm đến nay
 private void Ngaydaunamdennay(DateEdit tungay, DateEdit denngay)
 {
     DateTime ngaydaunam = HelpDate.GetStartOfCurrentYear();
     tungay.EditValue = ngaydaunam;
     denngay.EditValue = DateTime.Now;
 }
示例#48
0
        public void checkhd(string active, string role, LookUpEdit lencc, LookUpEdit lencs, TextEdit txtscs, DateEdit detn, DateEdit dedn, TextEdit txttsl, TextEdit txtdsl, TextEdit txtck, RadioButton rbthang, RadioButton rbquy, RadioButton rbnam, RadioButton rbkg, RadioButton rbtan, MemoEdit txtnd, LabelControl lauser)
        {
            string theo = "Tháng";

            if (rbquy.Checked == true)
            {
                theo = "Quý";
            }
            if (rbnam.Checked == true)
            {
                theo = "Năm";
            }

            string donvitinh = "Kg";

            if (rbtan.Checked == true)
            {
                donvitinh = "Tấn";
            }


            if (active == "0")
            {
                try
                {
                    txtscs.Text = (Double.Parse(gen.GetString("select Max(PolicyCode) from  Policy")) + 1).ToString();
                }
                catch { txtscs.Text = "1"; }
                string cha = txtscs.Text;
                if (lencs.EditValue != null)
                {
                    cha = lencs.EditValue.ToString();
                }

                gen.ExcuteNonquery("insert into Policy(PolicyID,PolicyCode,InventoryItemCode,PolicyName,BeginDate,EndDate,Unit,Discount,PolicyParent,Species,BeginQuantity,EndQuantity,UserName)"
                                   + "values(newid(),'" + txtscs.Text + "','" + lencc.EditValue + "',N'" + txtnd.Text + "','" + detn.EditValue + "','" + dedn.EditValue + "',N'" + donvitinh + "','" + txtck.EditValue.ToString().Replace(".", "") + "','" + cha + "',N'" + theo + "','" + txttsl.EditValue.ToString().Replace(".", "") + "','" + txtdsl.EditValue.ToString().Replace(".", "") + "',N'" + lauser.Text + "')");
            }
            else
            {
                string cha = txtscs.Text;
                if (lencs.EditValue != null)
                {
                    cha = lencs.EditValue.ToString();
                }
                gen.ExcuteNonquery("update Policy set PolicyCode='" + txtscs.Text + "',InventoryItemCode='" + lencc.EditValue + "',PolicyName=N'" + txtnd.Text + "',BeginDate='" + detn.EditValue + "',EndDate='" + dedn.EditValue + "',Unit=N'" + donvitinh + "',Discount='" + txtck.EditValue.ToString().Replace(".", "") + "',PolicyParent='" + cha + "',Species=N'" + theo + "',BeginQuantity='" + txttsl.EditValue.ToString().Replace(".", "") + "',EndQuantity='" + txtdsl.EditValue.ToString().Replace(".", "") + "',UserName=N'" + lauser.Text + "' where PolicyID='" + role + "'");
            }
        }
示例#49
0
 // Ngày đầu tuần đến nay
 private void Ngaydautuandennay(DateEdit tungay, DateEdit denngay)
 {
     DateTime ngaydautuan = HelpDate.GetStartOfCurrentWeek();
     tungay.EditValue = ngaydautuan;
     denngay.EditValue = DateTime.Now;
 }
示例#50
0
 /// <summary>
 /// 绑定日期选择控件(DateEdit)的EditValueChanged事件.
 /// 原因请叁考OnDateEditValueChange方法描述.
 /// </summary>        
 public static void BindingDateEditValueChangeEvent(DateEdit dateEdit)
 {
     dateEdit.EditValueChanged += new EventHandler(OnDateEditValueChange);
 }
示例#51
0
 // Ngày hôm qua
 private void Ngayhomqua(DateEdit tungay, DateEdit denngay)
 {
     tungay.EditValue = DateTime.Now.AddDays(-1);
     denngay.EditValue = DateTime.Now;
 }
示例#52
0
 /// <summary>
 /// 绑定日期输入控件的数据源
 /// </summary>
 /// <param name="edit">日期输入控件DateEdit</param>
 /// <param name="dataSource">数据源</param>
 /// <param name="bindField">取值字段</param>
 public static void BindingTextEditDateTime(DateEdit edit, object dataSource, string bindField)
 {
     try
     {
         edit.DataBindings.Clear();
         //不能绑定日期控件的DateTime属性. 只能为EditValue!
         Binding b = new Binding("EditValue", dataSource, bindField);
         b.NullValue = null;
         b.Parse += new ConvertEventHandler(DataBinder.DateStringToDate);
         b.Format += new ConvertEventHandler(DataBinder.DateToDateString);
         edit.DataBindings.Add(b);
     }
     catch (Exception ex)
     {
         Msg.ShowException(ex);
     }
 }
示例#53
0
 // Quý trước
 private void Quytruoc(DateEdit tungay, DateEdit denngay)
 {
     DateTime ngaydauquy = HelpDate.GetStartOfCurrentQuarter();
     tungay.EditValue = ngaydauquy.AddMonths(-3);
     DateTime ngaycuoiquy = HelpDate.GetEndOfCurrentQuarter();
     denngay.EditValue = ngaycuoiquy.AddMonths(-3);
 }
示例#54
0
        private void CreateDetail(Type EntityType, String Name = null, object Value = null)
        {
            #region ==================================== Labels + textboxs ====================================
            splitContainerControl.Panel2.Controls.Clear();
            var EntityProperties = EntityType.GetProperties();
            int index = 0;
            for (int i = 0; i < EntityProperties.Count(); i++)
            {
                var Pro = EntityProperties[i];
                var DisplayName = Pro.GetName();
                if (Pro.PropertyType.IsGenericType || Pro.Name.Substring(0, 2) == "FK") { }
                else
                {
                    var DataBindingsType = "Text";
                    var label = new LabelControl();
                    label.Location = new Point(20, 50 + 30 * index + 3);
                    label.Text = DisplayName;
                    label.Font = new Font(label.Font, CurrentMDI.IsKey(Pro.Name) ? FontStyle.Underline | FontStyle.Bold : FontStyle.Regular);
                    BaseEdit textbox = new TextEdit();
                    if(EntityType.IsForeignKey(Pro.Name))
                    {
                        var ForeignInfo = Pro.GetForeignKeyTargetName();
                        var TableName = ForeignInfo.Substring(0, ForeignInfo.IndexOf("_"));
                        var KeyName = ForeignInfo.Substring(ForeignInfo.IndexOf("_") + 1);
                        var x = Global.GetType(TableName);
                        var aList = x.Equals(typeof(DataContext.Menu)) ? GetMenuList() :
                                   (x.Equals(typeof(Quyen)) ? GetQuyenList() : Table.GetList(x, null, null, false));
                        if (aList != null)
                        {
                            var Ri = new LookUpEdit();
                            Ri.Properties.NullText = "Không có giá trị";
                            Ri.Properties.DataSource = aList;
                            Ri.Properties.ValueMember = KeyName;
                            Ri.Properties.BestFitMode = BestFitMode.BestFitResizePopup;
                            Ri.BindingContextChanged += new EventHandler(delegate(object sender, EventArgs e)
                            {
                                var Lookup = (sender as LookUpEdit);
                                Lookup.Properties.PopulateColumns();
                                Lookup.Properties.BestFit();
                                Lookup.Properties.AllowNullInput = DefaultBoolean.True;
                                if (Lookup.Properties.Columns.Count == 0) return;
                                var ci = 0;
                                foreach (var Column in x.GetProperties())
                                {
                                    if (Column.PropertyType.IsGenericType)
                                    {
                                        Lookup.Properties.Columns[ci].Visible = false;
                                    }
                                    else
                                    {
                                        Lookup.Properties.Columns[ci].Caption = Column.GetName();
                                        if (Column.PropertyType == typeof(DateTime))
                                        {
                                            if (Column.Name.Substring(0, 3) == "Gio")
                                                Lookup.Properties.Columns[ci].FormatString = "HH:mm tt";
                                            else
                                                Lookup.Properties.Columns[ci].FormatString = "dd/MM/yyy";
                                        }
                                    }
                                    ci++;
                                }
                            });
                            textbox = Ri;
                            DataBindingsType = "EditValue";
                        }
                    }
                    else if (Pro.PropertyType == typeof(DateTime))
                    {
                        var rDate = new DateEdit();
                        var rTime = new TimeEdit();

                        rDate.Properties.MinValue = new DateTime(1753, 1, 1); // SQL min value
                        if (Pro.Name.Substring(0, 3) == "Gio")
                            textbox = rTime;
                        else
                            textbox = rDate;

                        DataBindingsType = "EditValue";

                    }
                    else if (Pro.PropertyType == typeof(bool))
                    {
                        textbox = new CheckEdit();
                        DataBindingsType = "EditValue";
                    }
                    else if (Pro.PropertyType == typeof(int) || Pro.PropertyType == typeof(decimal) || Pro.PropertyType == typeof(double))
                    {
                        textbox = new CalcEdit();
                        DataBindingsType = "EditValue";
                    }
                    textbox.Location = new Point(120, 50 + 30 * index);
                    textbox.Width = 200;
                    textbox.TabIndex = index;
                    textbox.DataBindings.Add(DataBindingsType, gridView.DataSource, Pro.Name);
                    textbox.Properties.ReadOnly = true;
                    textbox.Name = Pro.Name;
                    splitContainerControl.Panel2.Controls.AddRange(new Control[] { label, textbox });
                    index++;
                }
            }
            #endregion

            #region ==================================== Buttons ====================================
            int bWidth = 60;
            int bX = 0;
            var btnEdit = new SimpleButton()
            {
                Text = "Chỉnh sửa",
                Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                Width = bWidth,
                Enabled = CurrentMDI.EnabledModify() && CurrentMDI.EnabledEdit() && gridView.SelectedRowsCount > 0
            };
            var btnCancelEdit = new SimpleButton()
            {
                Text = "Dừng sửa",
                Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                Width = 60,
                Visible = false
            };
            bX++;
            var btnUpdate = new SimpleButton()
            {
                Text = "Cập nhật",
                Location = new Point(5 + 5*bX + bWidth * bX, 50 + 30 * index),
                Width = 60,
                Enabled = false
            };
            bX++;
            var btnCreateNew = new SimpleButton()
            {
                Text = "Tạo mới",
                Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                Width = 60,
                Enabled = CurrentMDI.EnabledModify()
            };
            var btnCancelNew = new SimpleButton()
            {
                Text = "Dừng thêm",
                Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                Width = 60,
                Visible = false
            };
            bX++;
            var btnAddNew = new SimpleButton()
            {
                Text = "Thêm mới",
                Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                Width = 60,
                Enabled = false
            };
            bX++;
            var btnDelete = new SimpleButton()
            {
                Text = "Xoá",
                Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                Width = 60,
                Enabled = CurrentMDI.EnabledModify() && gridView.SelectedRowsCount > 0
            };
            index++;
            #endregion

            #region ==================================== Functions ====================================
            var Element = EntityType.CreateNew();

            Func<string, Control> GetControlByName = delegate(string ControlName)
            {
                foreach(Control c in splitContainerControl.Panel2.Controls)
                    if(c.Name == ControlName)
                        return c;

                return null;
            };

            Func<Exception, bool> ValidateEntity = delegate(Exception e)
            {
                dxErrorProvider.ClearErrors();
                bool isOk = false;
                if (e is SqlException)
                {
                    var dbEx = e as SqlException;
                    foreach (SqlError validationError in dbEx.Errors)
                    {
                        if (validationError.Message.IndexOf("]") > 0)
                        {
                            var PropertyName = validationError.Message.Substring(validationError.Message.IndexOf("[") + 1, validationError.Message.IndexOf("]")-1);
                            var ErrorMessage = validationError.Message.Substring(validationError.Message.IndexOf("]") + 1);
                            if (PropertyName.Equals("_Msg"))
                            {
                                MessageBox.Show(ErrorMessage);
                                isOk = true;
                            }
                            else
                            {
                                dxErrorProvider.SetError(GetControlByName(PropertyName), ErrorMessage, ErrorType.Default);
                            }
                        }

                    }
                }
                else
                {
                    ShowError(e);
                }
                return isOk;
            };

            Action<bool> SetReadOnly = delegate(bool IsReadOnly)
            {
                foreach (Control control in splitContainerControl.Panel2.Controls)
                {
                    if (control is BaseEdit)
                    {
                        (control as BaseEdit).Properties.ReadOnly = IsReadOnly;
                        if (CurrentMDI.IsKey(control.Name) && !IsReadOnly && !btnAddNew.Enabled)
                        {
                            (control as BaseEdit).Properties.ReadOnly = true;
                        }
                        if (control.Tag != null)
                        {
                            (control.Tag as Control).Enabled = !IsReadOnly;
                        }
                        if (control.Name == Name)
                        {
                            (control as BaseEdit).Properties.ReadOnly = true;
                        }

                        if (control is LookUpEdit && (control as BaseEdit).Properties.ReadOnly == false)
                        {
                            if (EntityType.IsFKContained(control.Name))
                            {
                                var A = EntityType.Name;
                                var MDI = (MasterDetailInfo)(control as LookUpEdit).Properties.DataSource.GetType().GenericTypeArguments[0].CreateNew();
                                var V = (GetControlByName(CurrentMDI.GetKeyName()) as BaseEdit).EditValue;
                                var aList = Table.GetList(MDI.GetType(), A, V, false);
                                (control as LookUpEdit).Properties.DataSource = aList;
                            }
                        }
                    }
                }
            };

            Action DefaultButtonDisplay = delegate()
            {
                btnEdit.Enabled = CurrentMDI.EnabledEdit() && gridView.SelectedRowsCount > 0;
                btnEdit.Visible = true;
                btnCancelEdit.Visible = false;
                btnUpdate.Enabled = false;
                btnCreateNew.Enabled = btnCreateNew.Visible = true;
                btnCancelNew.Visible = false;
                btnAddNew.Enabled = false;
                btnDelete.Enabled = gridView.SelectedRowsCount > 0;
            };

            Func<MasterDetailInfo> GetCurrentRecord = delegate()
            {
                var AElement = EntityType.CreateNew();
                foreach (Control control in splitContainerControl.Panel2.Controls)
                {
                    if (control is BaseEdit)
                    {
                        AElement.SetPropertyValue(control.Name, (control as BaseEdit).EditValue);
                    }
                }
                return (AElement as MasterDetailInfo);
            };

            #endregion

            #region ==================================== Button Events ====================================
            btnEdit.Click += new EventHandler(delegate(object sender, EventArgs e)
                {
                    foreach (Control control in splitContainerControl.Panel2.Controls)
                    {
                        if (control is BaseEdit)
                        {
                            Element.SetPropertyValue(control.Name, (control as BaseEdit).EditValue);
                        }
                    }
                    DefaultButtonDisplay();
                    btnCancelEdit.Visible = btnUpdate.Enabled = true;
                    btnEdit.Visible = btnCreateNew.Enabled = btnDelete.Enabled = false;
                    SetReadOnly(false);
                    DataGridView.Enabled = false;
                });

            btnCancelEdit.Click += new EventHandler(delegate(object sender, EventArgs e)
            {
                foreach (Control control in splitContainerControl.Panel2.Controls)
                {
                    if (control is BaseEdit)
                    {
                        (control as BaseEdit).EditValue = Element.GetPropertyValue(control.Name);
                    }
                }
                DefaultButtonDisplay();
                SetReadOnly(true);
                DataGridView.Enabled = true;
                dxErrorProvider.ClearErrors();

            });

            btnUpdate.Click += new EventHandler(delegate(object sender, EventArgs e)
            {
                var NewElement = GetCurrentRecord();
                bool isOk = false;
                try
                {
                    Table.Update(NewElement);
                }
                catch (Exception ex)
                {
                    isOk = ValidateEntity(ex);
                }
                finally
                {
                    if (isOk)
                    {
                        dxErrorProvider.ClearErrors();
                        DefaultButtonDisplay();
                        SetReadOnly(true);
                        DataGridView.Enabled = true;
                    }
                }
            });

            btnCreateNew.Click += new EventHandler(delegate(object sender, EventArgs e)
            {
                gridView.AddNewRow();
                if (!string.IsNullOrEmpty(Name))
                {
                    var txt = (GetControlByName(Name) as BaseEdit);
                    txt.EditValue = Value;
                    txt.BindingManager.EndCurrentEdit();
                }
                DefaultButtonDisplay();
                btnCancelNew.Visible = btnAddNew.Enabled = true;
                btnCreateNew.Visible = btnEdit.Enabled = btnDelete.Enabled = false;
                SetReadOnly(false);
                DataGridView.Enabled = false;
            });

            btnCancelNew.Click += new EventHandler(delegate(object sender, EventArgs e){
                gridView.DeleteSelectedRows();
                DefaultButtonDisplay();
                SetReadOnly(true);
                DataGridView.Enabled = true;
                dxErrorProvider.ClearErrors();
            });

            btnAddNew.Click += new EventHandler(delegate(object sender, EventArgs e)
            {
                var NewElement = GetCurrentRecord();
                bool isOk = true;
                try
                {
                    Table.Insert(NewElement);
                }
                catch (Exception ex)
                {
                    isOk = ValidateEntity(ex);
                }
                finally
                {
                    if (isOk)
                    {
                        dxErrorProvider.ClearErrors();
                        DefaultButtonDisplay();
                        SetReadOnly(true);
                        DataGridView.Enabled = true;
                    }
                }
            });

            btnDelete.Click += new EventHandler(delegate(object sender, EventArgs e)
            {
                var AElement = GetCurrentRecord();
                try
                {
                    gridView.DeleteSelectedRows();
                    Table.Delete(AElement);
                }
                catch (System.Exception ex)
                {
                    ValidateEntity(ex);
                }
            });
            #endregion

            splitContainerControl.Panel2.Controls.AddRange(new Control[] { btnEdit, btnCancelEdit, btnUpdate, btnCreateNew, btnCancelNew, btnAddNew, btnDelete });

            #region ==================================== Relation ====================================
            var Count = CurrentMDI.GetRelationCount();
            bX = 0;
            bWidth = 160;
            for (int i = 0; i < Count; i++)
            {
                var MDI = (MasterDetailInfo)CurrentMDI.GetRelationType(i).CreateNew();
                var aName = MDI.GetType().Name;
                var aButton = new SimpleButton()
                {
                    Name = "btnRelation_"+ aName,
                    Text = MDI.GetName(),
                    Location = new Point(5 + 5 * bX + bWidth * bX, 50 + 30 * index),
                    Width = bWidth,
                    Enabled = DSQuyen.Where(m => m.Quyen > 1 && m.Menu.Contains(aName)).Count() > 0 || Username == "admin"
                };
                aButton.Click += new EventHandler(delegate(object sender, EventArgs e)
                {
                    var TableName = CurrentMDI.GetType().Name;
                    var ColumnName = MDI.GetForeignKeyColumn(TableName);

                    var KeyValue = GetCurrentRecord().GetKeyValue();
                    UpdateGridView(MDI, ColumnName, KeyValue);
                    //gridView.Columns[0].FilterInfo = new ColumnFilterInfo(gridView.Columns[ColumnName], KeyValue);
                });
                splitContainerControl.Panel2.Controls.Add(aButton);
                index = bX > 0 ? index + 1 : index;
                bX = bX > 0 ? 0 : bX + 1;
            }
            #endregion
        }
示例#55
0
 //--Những hàm dùng để lấy ngày tháng hiện tại --
 private void Thanghientai(DateEdit tungay, DateEdit denngay)
 {
     DateTime ngaydauthang = HelpDate.GetStartOfCurrentMonth();
     tungay.EditValue = ngaydauthang;
     DateTime ngaycuoicuathang = HelpDate.GetEndOfCurrentMonth();
     denngay.EditValue = ngaycuoicuathang;
 }
示例#56
0
        public void loadcnh(CheckEdit cechd, string active, string role, DevExpress.XtraGrid.GridControl gridControl1, GridView gridView1, TextEdit txtsct, ComboBoxEdit cbldt, LookUpEdit ledv, DateEdit denct, DateEdit denht,
                            DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit repositoryItemLookUpEdit1, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit tkco, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit rpkh,
                            DevExpress.XtraEditors.Repository.RepositoryItemDateEdit nphhd, DevExpress.XtraEditors.Repository.RepositoryItemTextEdit sotien, Frm_phieuthu F, LookUpEdit ledt, TextEdit txtnn, TextEdit txtldn, TextEdit txtctg,
                            ToolStripButton tsbtsua, ToolStripButton tsbtxoa, ToolStripButton tsbtcat, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtnap, ToolStripButton tsbtin, string ngaychungtu, string tsbt, ComboBoxEdit cbthue, TextEdit txthtt, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, DataTable khach, string userid, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit rpmanganh, DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit rpmachiphi, SearchLookUpEdit danhmuc)
        {
            DataTable  dt  = new DataTable();
            phieuchitm ctm = new phieuchitm();

            ctm.loadstart(cechd, gridControl1, gridView1, cbldt, ledv, denct, denht, repositoryItemLookUpEdit1, tkco, rpkh, nphhd, sotien, ledt, tsbtsua, tsbtxoa, tsbtcat, tsbtboghi, tsbtghiso, tsbtnap, tsbtin, ngaychungtu, dt, tsbt, cbthue, khach, userid, rpmanganh, rpmachiphi, danhmuc);
            if (active == "1")
            {
                DataTable da = new DataTable();
                da = gen.GetTable("select  a.Description,DebitAccount,CreditAccount,Amount,AccountingObjectCode,InvDate,InvSeries,InvNo,CustomField5,CustomField4 from BATransferDetail a,AccountingObject b where a.AccountingObjectID=b.AccountingObjectID and RefID='" + role + "' order by SortOrder");
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = da.Rows[i][1].ToString();
                    dr[1] = da.Rows[i][2].ToString();
                    if (da.Rows[i][5].ToString() != "")
                    {
                        dr[2]         = DateTime.Parse(da.Rows[i][5].ToString());
                        cechd.Checked = true;
                    }
                    dr[3] = da.Rows[i][7].ToString();
                    dr[4] = da.Rows[i][6].ToString();
                    dr[5] = da.Rows[i][8].ToString();
                    dr[6] = da.Rows[i][3].ToString();
                    dr[7] = da.Rows[i][4].ToString();
                    dr[8] = da.Rows[i][0].ToString();
                    dr[9] = da.Rows[i][9].ToString();
                    dt.Rows.Add(dr);
                }
                gridControl1.DataSource = dt;
                tsbtcat.Enabled         = false;

                F.Text = "Xem phiếu chi ngân hàng";
                da     = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,Tax,ExDate,a.RefOrder  from BATransfer a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + role + "'");
                try
                {
                    cbldt.SelectedIndex = Int32.Parse(da.Rows[0][9].ToString());
                }
                catch { }
                try
                {
                    txthtt.EditValue = Double.Parse(da.Rows[0][12].ToString());
                }
                catch { txthtt.EditValue = 0; }
                ledv.EditValue    = da.Rows[0][7].ToString();
                ledt.EditValue    = da.Rows[0][0].ToString();
                txtnn.Text        = da.Rows[0][1].ToString();
                txtldn.Text       = da.Rows[0][2].ToString();
                txtctg.Text       = da.Rows[0][3].ToString();
                denct.EditValue   = DateTime.Parse(da.Rows[0][4].ToString());
                denht.EditValue   = DateTime.Parse(da.Rows[0][5].ToString());
                txtsct.Text       = da.Rows[0][6].ToString();
                cbthue.EditValue  = da.Rows[0][11].ToString();
                danhmuc.EditValue = da.Rows[0][13].ToString();
                if (da.Rows[0][8].ToString() == "True")
                {
                    tsbtghiso.Visible = false;
                    tsbtboghi.Visible = true;
                    tsbtsua.Enabled   = false;
                }
                else
                {
                    tsbtboghi.Visible = false;
                    tsbtghiso.Visible = true;
                }
                if (da.Rows[0][10].ToString() == "True")
                {
                    tsbtboghi.Enabled = false;
                    tsbtghiso.Enabled = false;
                }
                checktruocsau(tsbttruoc, tsbtsau, txtsct.Text, ngaychungtu, userid);
            }
            else
            {
                try
                {
                    F.Text           = "Thêm phiếu chi ngân hàng";
                    txthtt.EditValue = 0;
                    themsct(ngaychungtu, txtsct, tsbttruoc, tsbtsau, userid);

                    denct.EditValue = DateTime.Parse(ngaychungtu);
                    denht.EditValue = DateTime.Parse(ngaychungtu);
                    cechd.Checked   = true;
                    cechd.Checked   = false;
                }
                catch
                {
                    XtraMessageBox.Show("Vui lòng kiểm tra lại < Ngày chứng từ >.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    F.Close();
                }
            }
        }
示例#57
0
 //*--Những hàm dùng để lấy tuần hiện tại */
 private void Tuanhientai(DateEdit tungay, DateEdit denngay)
 {
     DateTime dautuan = HelpDate.GetStartOfCurrentWeek(); ;
     DateTime cuoituan = HelpDate.GetEndOfCurrentWeek();
     tungay.EditValue = dautuan;
     denngay.EditValue = cuoituan;
 }
示例#58
0
        //save//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void checkpcnh(string active, string role, Frm_phieuthu F, GridView gridView1, LookUpEdit ledt, LookUpEdit ledv, ComboBoxEdit cbldt, TextEdit txtsct, TextEdit txtname, TextEdit txtdc,
                              TextEdit txtnn, TextEdit txtctg, TextEdit txtldn, DateEdit denct, DateEdit denht, ToolStripButton tsbtboghi, ToolStripButton tsbtghiso, ToolStripButton tsbtxoa,
                              ToolStripButton tsbtcat, ToolStripButton tsbtin, ToolStripButton tsbtsua, ToolStripButton tsbtnap, string ngaychungtu, ComboBoxEdit cbthue, string userid, TextEdit txthtt, ToolStripSplitButton tsbttruoc, ToolStripSplitButton tsbtsau, SearchLookUpEdit danhmuc)
        {
            try
            {
                string dt = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + ledt.EditValue.ToString() + "'");
                string[,] detail = new string[20, 15];
                string check = "0";
                for (int i = 0; i < gridView1.RowCount - 1; i++)
                {
                    if (gridView1.GetRowCellValue(i, "Tài khoản có").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 0] = gridView1.GetRowCellValue(i, "Tài khoản có").ToString();
                    if (gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 1] = gridView1.GetRowCellValue(i, "Tài khoản nợ").ToString();

                    detail[i, 2] = "NULL";
                    if (gridView1.GetRowCellValue(i, "Ngày phát hành HĐ").ToString() != "")
                    {
                        detail[i, 2] = "'" + gridView1.GetRowCellValue(i, "Ngày phát hành HĐ").ToString() + "'";
                    }

                    detail[i, 3] = gridView1.GetRowCellValue(i, "Loại hóa đơn").ToString();
                    detail[i, 4] = gridView1.GetRowCellValue(i, "Số hóa đơn").ToString();
                    if (gridView1.GetRowCellValue(i, "Số tiền").ToString() == "")
                    {
                        check = "1";
                    }
                    detail[i, 5] = gridView1.GetRowCellValue(i, "Số tiền").ToString().Replace(".", "");

                    if (gridView1.GetRowCellValue(i, "Mã khách").ToString() == "")
                    {
                        check = "1";
                    }
                    else
                    {
                        string mk = gen.GetString("select * from AccountingObject where AccountingObjectCode='" + gridView1.GetRowCellValue(i, "Mã khách").ToString() + "'");
                        detail[i, 6] = mk;
                    }
                    detail[i, 7] = gridView1.GetRowCellValue(i, "Diễn giải").ToString();
                    detail[i, 8] = gridView1.GetRowCellValue(i, "Ký hiệu hóa đơn").ToString();
                    detail[i, 9] = gridView1.GetRowCellValue(i, "Nhóm chi phí").ToString();
                }
                if (check == "1")
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("Vui lòng kiểm tra lại dữ liệu <Tài khoản có> <Tài khoản nợ> <Số tiền> <Mã Khách> !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string dv   = gen.GetString("select * from Stock where StockCode='" + ledv.EditValue.ToString() + "'");
                    string tong = gridView1.Columns["Số tiền"].SummaryText;
                    tong = tong.Replace("Tổng tiền =", "").Trim();
                    tong = tong.Replace(".", "");
                    string ldt;
                    if (cbldt.EditValue.ToString() == "Khách hàng")
                    {
                        ldt = "0";
                    }
                    else if (cbldt.EditValue.ToString() == "Nhà cung cấp")
                    {
                        ldt = "1";
                    }
                    else
                    {
                        ldt = "2";
                    }
                    if (active == "0")
                    {
                        try
                        {
                            string ton = gen.GetString("select * from BATransfer where RefNo='" + txtsct.Text + "'");
                            themsct(ngaychungtu, txtsct, tsbttruoc, tsbtsau, userid);
                            XtraMessageBox.Show("Số phiếu trùng, hệ thống tự động chỉnh số phiếu của bạn thành " + txtsct.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch { }
                        gen.ExcuteNonquery("insert into BATransfer(RefID,RefType,RefDate,PostedDate,RefNo,AccountingObjectID,AccountingObjectName,AccountingObjectAddress,Contactname,JournalMemo,DocumentIncluded,Posted,StockID,AccountingObjectType,TotalAmount,Tax,UserID,ExDate,RefOrder) values(newid(),101,'" + denct.EditValue.ToString() + "','" + denht.EditValue.ToString() + "','" + txtsct.Text + "','" + dt + "',N'" + txtname.Text + "','" + txtdc.Text + "',N'" + txtnn.Text + "',N'" + txtldn.Text + "',N'" + txtctg.Text + "','False','" + dv + "','" + ldt + "','" + tong + "','" + cbthue.Text + "','" + userid + "','" + txthtt.EditValue.ToString() + "','" + danhmuc.EditValue.ToString() + "')");
                        string refid = gen.GetString("select * from BATransfer where RefNo='" + txtsct.Text + "'");
                        F.getrole(refid);
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            /*if (detail[i, 2] == "")
                             * {
                             *  gen.ExcuteNonquery("insert into BATransferDetail(RefDetailID,RefID,Description,DebitAccount,CreditAccount,Amount,AccountingObjectID,SortOrder,CustomField5) values(newid(),'" + refid + "',N'" + detail[i, 7] + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 6] + "'," + i + ",'" + detail[i, 8] + "')");
                             * }
                             * else
                             * {*/
                            gen.ExcuteNonquery("insert into BATransferDetail(RefDetailID,RefID,Description,DebitAccount,CreditAccount,Amount,AccountingObjectID,InvDate,InvSeries,InvNo,SortOrder,CustomField5,CustomField4) values(newid(),'" + refid + "',N'" + detail[i, 7] + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 6] + "'," + detail[i, 2] + ",'" + detail[i, 3] + "','" + detail[i, 4] + "'," + i + ",'" + detail[i, 8] + "',N'" + detail[i, 9] + "')");
                            //}
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain,CABA,Occupation,GroupCost) values(newid(),'" + refid + "','" + txtsct.Text + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 6] + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "','" + denct.EditValue.ToString() + "','" + detail[i, 7] + "',N'" + detail[i, 9] + "')");
                        }
                    }
                    else
                    {
                        gen.ExcuteNonquery("update BATransfer set RefDate='" + denct.EditValue.ToString() + "',PostedDate='" + denht.EditValue.ToString() + "',AccountingObjectID='" + dt + "',AccountingObjectName=N'" + txtname.Text + "',AccountingObjectAddress='" + txtdc.Text + "',Contactname=N'" + txtnn.Text + "',JournalMemo=N'" + txtldn.Text + "',DocumentIncluded=N'" + txtctg.Text + "',StockID='" + dv + "',AccountingObjectType='" + ldt + "',TotalAmount='" + tong + "',Posted='False', Tax='" + cbthue.Text + "',UserID='" + userid + "',ExDate='" + txthtt.EditValue.ToString() + "',RefOrder='" + danhmuc.EditValue.ToString() + "'  where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete  from  BATransferDetail where RefID='" + role + "'");
                        gen.ExcuteNonquery("insert into HACHTOANBK select *,GetDate() from HACHTOAN where RefID='" + role + "'");
                        gen.ExcuteNonquery("delete HACHTOAN where RefID='" + role + "'");
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            /*if (detail[i, 2] == "")
                             * {
                             *  gen.ExcuteNonquery("insert into BATransferDetail(RefDetailID,RefID,Description,DebitAccount,CreditAccount,Amount,AccountingObjectID,SortOrder,CustomField5) values(newid(),'" + role + "',N'" + detail[i, 7] + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 6] + "'," + i + ",'" + detail[i, 8] + "')");
                             * }
                             * else
                             * {*/
                            gen.ExcuteNonquery("insert into BATransferDetail(RefDetailID,RefID,Description,DebitAccount,CreditAccount,Amount,AccountingObjectID,InvDate,InvSeries,InvNo,SortOrder,CustomField5,CustomField4) values(newid(),'" + role + "',N'" + detail[i, 7] + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 6] + "'," + detail[i, 2] + ",'" + detail[i, 3] + "','" + detail[i, 4] + "'," + i + ",'" + detail[i, 8] + "',N'" + detail[i, 9] + "')");
                            //}
                            gen.ExcuteNonquery("insert into HACHTOAN(RefDeteail,RefID,RefNo,DebitAccount,CreditAccount,Amount,AccountingObjectID,StockID,JournalMemo,RefDate,AccountingObjectIDMain,CABA,Occupation,GroupCost) values(newid(),'" + role + "','" + txtsct.Text + "','" + detail[i, 1] + "','" + detail[i, 0] + "','" + detail[i, 5] + "','" + detail[i, 6] + "','" + dv + "',N'" + txtldn.Text + "','" + denct.EditValue.ToString() + "','" + dt + "','" + denct.EditValue.ToString() + "','" + detail[i, 7] + "',N'" + detail[i, 9] + "')");
                        }
                    }
                    F.myac();
                    F.getactive("1");
                    F.Text = "Xem phiếu chi ngân hàng";
                }
            }
            catch
            {
                XtraMessageBox.Show("Vui lòng chọn đối tượng trước khi lưu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#59
0
 // Khởi tạo một UserControl
 public void _init(DateEdit tungay, DateEdit denngay)
 {
     this._TuNgay = tungay;
     this._DenNgay = denngay;
 }
示例#60
0
        public bool CheckForPartTimeFields(ref string message, ComboBoxEdit billid, TextEdit chequeNumber, DateEdit ChequeDate, TextEdit chequeAmount, int row)
        {
            bool retVal = true;
            ArrayList list = new ArrayList();
            if (ValidationClass.IsComboEditSelectedIndexZero(billid))
            {
                list.Add(true);
                message += "Please select the debit bill number " + "\n\r";
            }
            else
            {
                list.Add(false);
            }
            if (ValidationClass.IsTextEditEmptyOrSingleZero(chequeNumber))
            {
                list.Add(true);
                message += "Cheque Number Cannot be Empty or Zero for Row " + row.ToString() + "\n\r";
            }
            else
            {
                list.Add(false);
            }
            if (ValidationClass.IsDateEditEmpty(ChequeDate))
            {
                list.Add(true);
                message += "Cheque Amount Cannot be Empty for Row " + row.ToString() + "\n\r";
            }
            else
            {
                list.Add(false);
            }
            if (ValidationClass.IsTextEditEmptyOrSingleZero(chequeAmount))
            {
                list.Add(true);
                message += "Cheque Amount Cannot be Empty or Zero for Row " + row.ToString() + "\n\r";
            }
            else
            {
                list.Add(false);
            }

            foreach (bool b in list)
            {
                if (b == true)
                {
                    retVal = false;
                }
            }
            return retVal;
        }