Пример #1
0
        private String setSoPhieu()
        {
            NdataFunc f      = new NdataFunc();
            string    lastID = f.getLasFieldValue("PhieuCan", "So_Phieu");

            return(f.NextID(lastID));
        }
Пример #2
0
        private void frmPhieuCanHang_Load(object sender, EventArgs e)
        {
            try
            {
                // Loads data into the 'dsNdataMrp.PhieuCan' table.
                this.phieuCanTableAdapter.Fill(this.dsNdataMrp.PhieuCan);
                phieuCanBindingSource.AddNew();

                //dateTime format
                dateTimePickerNgayCan.Value        = DateTime.Today;
                dateTimePickerNgayCan.Format       = System.Windows.Forms.DateTimePickerFormat.Custom;
                dateTimePickerNgayCan.CustomFormat = "dd-MM-yyyy";

                //dateTimePickerGioDen.Text = DateTime.Now.ToShortTimeString();
                dateTimePickerGioDen.Format       = DateTimePickerFormat.Custom;
                dateTimePickerGioDen.CustomFormat = "HH:mm";
                dateTimePickerGioDen.ShowUpDown   = true;
                dateTimePickerGioDen.Value        = DateTime.Now;

                //Load MaKH
                NdataFunc f    = new NdataFunc();
                String    sSQL = "SELECT supplier_code, supplier_name FROM dbo.Suppliers ORDER BY supplier_name ASC";
                f.addToComboBox1(cmbMaKH, sSQL, "supplier_code");

                //Load TenKH
                sSQL = "SELECT supplier_code, supplier_name FROM dbo.Suppliers ORDER BY supplier_name ASC";
                f.addToComboBox(cmbTenKH, sSQL, "supplier_name", "supplier_code");
                cmbTenKH.SelectedIndex = -1;

                //load Items No
                sSQL = "SELECT item_no, name FROM dbo.Items ORDER BY item_no ASC";
                f.addToComboBox1(cmbMaNL, sSQL, "item_no");

                //load Items
                sSQL = "SELECT item_no, name FROM dbo.Items ORDER BY name ASC";
                f.addToComboBox(cmbItem, sSQL, "name", "item_no");
                cmbItem.SelectedIndex = -1;

                //Set default status
                txtStatus.Text = "10";

                //Set default QC note
                txtQCNote.Text  = "Đánh giá chất lượng";
                chkOkQC.Checked = true;

                //Input PhieuCan
                initPhieuCanChiTiet(txtSoPhieu.Text);

                //input NguoiCan
                cmbNguoiCan.Text = f.getLasFieldValue("NhanVien", "HoTen", "MaNV=N'" + Program.usrCurrent.ma_NV + "' ");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }