예제 #1
0
        private void btnDeleteProductImportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbIDProductDetailStore.Text == "" || txtQuantity.Text == "" || txtWeight.Text == "" || txtTransPrice.Text == "")
                {
                    XtraMessageBox.Show("You have to choose at least 1 field to delete", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                PostInvoiceDetails_DTO invoiceDetails = new PostInvoiceDetails_DTO();
                invoiceDetails.TransDetailsID = txtTransDetailsID.Text;
                invoiceDetails.ProductID      = txtProductID.Text;


                if (PostInvoiceDetails_BUS.DeletePostInvoiceDetails(invoiceDetails))
                {
                    LoadPostInvoice();
                    LoadPostInvoiceDetails();
                    XtraMessageBox.Show("Delete details sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearDisplay1();
                    return;
                }
            }catch
            {
                XtraMessageBox.Show("Xóa chi tiết hóa đơn thất bại ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #2
0
        private void btnAddProductImportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbIDProductDetailStore.Text == "" || txtQuantity.Text == "" || txtWeight.Text == "" || txtTransPrice.Text == "")
                {
                    XtraMessageBox.Show("You have to fullfill all fields!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                PostInvoiceDetails_DTO invoiceDetails = new PostInvoiceDetails_DTO();
                invoiceDetails.TransID             = cmbIDBillImportDetail.Text;
                invoiceDetails.ProductName         = cmbIDProductDetailStore.Text;
                invoiceDetails.ProductCategoryName = cmbProductCategory.Text;
                invoiceDetails.UnitName            = cmbUnit.Text;
                invoiceDetails.TransQuantity       = Convert.ToInt32(txtQuantity.Text.ToString());
                invoiceDetails.Weight     = txtWeight.Text;
                invoiceDetails.TransPrice = txtTransPrice.Text;

                if (PostInvoiceDetails_BUS.InsertPostInvoiceDetails(invoiceDetails))
                {
                    LoadPostInvoice();
                    LoadPostInvoiceDetails();
                    XtraMessageBox.Show("Insert details sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //uctSanPhamCH.uctSPCH.LoadSanPhamCH1();
                    ClearDisplay1();
                    return;
                }
            }catch
            {
                XtraMessageBox.Show("Sản phẩm đã tồn tại trong Hóa đơn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #3
0
        private void LoadPostInvoiceDetails()
        {
            List <PostInvoiceDetails_DTO> listInvoice = PostInvoiceDetails_BUS.LoadPostInvoiceDetails(Convert.ToInt32(txtIDBillImport.Text));

            dtgvListOfDetailProductImport.DataSource = listInvoice;
            txtTotal.Text = Convert.ToString(dtgvInfoListOfBillImport.CurrentRow.Cells["TotalPrice"].Value);

            if (dtgvListOfDetailProductImport.Rows.Count != 1)
            {
                dtgvListOfDetailProductImport.Columns["TransID"].Visible = false;
            }
        }
예제 #4
0
        private void dtgvInfoListOfBillImport_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
            {
                txtIDBillImport.Text       = Convert.ToString(dtgvInfoListOfBillImport.CurrentRow.Cells["TransID"].Value);
                txtVendorId.Text           = Convert.ToString(dtgvInfoListOfBillImport.CurrentRow.Cells["VendorID"].Value);
                cmbIDAgency.Text           = Convert.ToString(dtgvInfoListOfBillImport.CurrentRow.Cells["VendorName"].Value);
                dtpkDateTimeImport.Text    = Convert.ToString(dtgvInfoListOfBillImport.CurrentRow.Cells["CreateDate"].Value);
                cmbIDBillImportDetail.Text = txtIDBillImport.Text;
                txtTotal.Text = Convert.ToString(dtgvInfoListOfBillImport.CurrentRow.Cells["TotalPrice"].Value);

                List <PostInvoiceDetails_DTO> listInvoice = PostInvoiceDetails_BUS.LoadPostInvoiceDetails(Convert.ToInt32(txtIDBillImport.Text));
                dtgvListOfDetailProductImport.DataSource = listInvoice;

                if (dtgvListOfDetailProductImport.Rows.Count > 1)
                {
                    dtgvListOfDetailProductImport.Columns["TransID"].Visible = false;
                }
            }
        }
예제 #5
0
        private void btnUpdateProductImportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbIDProductDetailStore.Text == "" || txtQuantity.Text == "" || txtWeight.Text == "" || txtTransPrice.Text == "")
                {
                    XtraMessageBox.Show("You have to choose at least 1 field to update", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                PostInvoiceDetails_DTO invoiceDetails = new PostInvoiceDetails_DTO();
                invoiceDetails.TransID             = cmbIDBillImportDetail.Text;
                invoiceDetails.TransDetailsID      = txtTransDetailsID.Text;
                invoiceDetails.ProductID           = txtProductID.Text;
                invoiceDetails.ProductName         = cmbIDProductDetailStore.Text;
                invoiceDetails.ProductCategoryName = cmbProductCategory.Text;
                invoiceDetails.UnitName            = cmbUnit.Text;
                invoiceDetails.TransQuantity       = Convert.ToInt32(txtQuantity.Text.ToString());
                invoiceDetails.Weight     = txtWeight.Text;
                invoiceDetails.TransPrice = txtTransPrice.Text;


                if (PostInvoiceDetails_BUS.UpdatePostInvoiceDetails(invoiceDetails))
                {
                    LoadPostInvoice();
                    LoadPostInvoiceDetails();

                    XtraMessageBox.Show("Update details sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearDisplay1();
                    return;
                }
            }catch
            {
                XtraMessageBox.Show("Chi tiết phiếu nhập hàng cập nhật thất bại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }