Exemplo n.º 1
0
        private void btnDeleteProductExportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTransQuantity.Text == "")
                {
                    XtraMessageBox.Show("You have to choose at least 1 record to delete!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }


                SaleInvoiceDetails_DTO invoice = new SaleInvoiceDetails_DTO();
                invoice.TransDetailsID = txtTransDetailsID.Text;
                invoice.TransChange    = Convert.ToInt32(dtgvDetailBillSale.CurrentRow.Cells["TransQuantity"].Value.ToString());
                invoice.ProductID      = cmbIDProductDetailStore.Text;

                if (SaleInvoiceDetails_BUS.DeleteSaleInvoiceDetails(invoice))
                {
                    LoadSaleInvoice();
                    LoadSaleInvoiceDetails();
                    LoadProduct();
                    uctProduct.uctSPCH.LoadProductList();
                    XtraMessageBox.Show("Delete detail sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    ClearDisplay1();
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Delete detail failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 2
0
        private void btnAddProductExportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTransQuantity.Text == "")
                {
                    XtraMessageBox.Show("You have to input quantity!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int num;
                if (txtTransQuantity.Text == "")
                {
                    num = 0;
                }
                else
                {
                    num = Convert.ToInt32(txtTransQuantity.Text.ToString());
                }

                int num1 = Convert.ToInt32(cmbPQuatity.Text.ToString());


                if (num > num1)
                {
                    XtraMessageBox.Show("Not enough products in store!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTransQuantity.Text = "";
                    return;
                }
                else
                {
                    SaleInvoiceDetails_DTO invoice = new SaleInvoiceDetails_DTO();
                    invoice.TransID       = cmbIDBillExportDetail.Text;
                    invoice.ProductID     = cmbIDProductDetailStore.Text;
                    invoice.TransQuantity = Convert.ToInt32(txtTransQuantity.Text);
                    invoice.TransPrice    = txtTransPrice.Text;
                    invoice.Total         = txtTotal.Text;

                    if (SaleInvoiceDetails_BUS.InsertSaleInvoiceDetails(invoice))
                    {
                        LoadSaleInvoice();
                        LoadSaleInvoiceDetails();
                        LoadProduct();
                        uctProduct.uctSPCH.LoadProductList();
                        XtraMessageBox.Show("Insert detail sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        ClearDisplay1();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 3
0
        private void btnUpdateProductExportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTransQuantity.Text == "")
                {
                    XtraMessageBox.Show("You have to input quantity!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int originQuantity = Convert.ToInt32(dtgvDetailBillSale.CurrentRow.Cells["TransQuantity"].Value.ToString());
                int newQuantity    = Convert.ToInt32(txtTransQuantity.Text.ToString());
                int change         = newQuantity - originQuantity;

                int prodQuantity = Convert.ToInt32(cmbPQuatity.Text.ToString());

                if (change > prodQuantity)
                {
                    XtraMessageBox.Show("Not enough products in store!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTransQuantity.Text = "";
                    return;
                }

                SaleInvoiceDetails_DTO invoice = new SaleInvoiceDetails_DTO();
                invoice.TransID        = cmbIDBillExportDetail.Text;
                invoice.TransDetailsID = txtTransDetailsID.Text;
                invoice.ProductID      = cmbIDProductDetailStore.Text;
                invoice.TransQuantity  = Convert.ToInt32(txtTransQuantity.Text);
                invoice.TransChange    = change;
                invoice.TransPrice     = txtTransPrice.Text;
                invoice.Total          = txtTotal.Text;

                if (SaleInvoiceDetails_BUS.UpdateSaleInvoiceDetails(invoice))
                {
                    LoadSaleInvoice();
                    LoadSaleInvoiceDetails();
                    LoadProduct();
                    uctProduct.uctSPCH.LoadProductList();
                    XtraMessageBox.Show("Update detail sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    ClearDisplay1();
                    return;
                }
            }
            catch
            {
                XtraMessageBox.Show("Update detail failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 4
0
        private void LoadSaleInvoiceDetails()
        {
            List <SaleInvoiceDetails_DTO> listInvoice = SaleInvoiceDetails_BUS.LoadSaleInvoiceDetails(Convert.ToInt32(cmbIDBillExportDetail.Text));

            dtgvDetailBillSale.DataSource = listInvoice;
        }