Ejemplo n.º 1
0
        private void dgv_Product_DoubleClick(object sender, EventArgs e)
        {
            DEProduct product = new DEProduct();

            product.Product_Id = Convert.ToInt32(dgv_Product.CurrentRow.Cells[1].Value);

            BLLProduct obj_BLLProduct = new BLLProduct();
            bool       bool_Result    = obj_BLLProduct.LoadProductRow(product);

            if (bool_Result == true)
            {
                DisplayData(product);
            }
            else
            {
                MessageBox.Show("Record is not found.");
            }

            product        = null;
            obj_BLLProduct = null;
        }
        private void search()
        {
            BLLInvoiceDetail       obj_BLLInvoiceDetail       = new BLLInvoiceDetail();
            BLLInvoiceReturnDetail obj_BLLInvoiceReturnDetail = new BLLInvoiceReturnDetail();
            BLLProduct             obj_BLLProduct             = new BLLProduct();

            DEInvoiceDetail       invDetail  = new DEInvoiceDetail();
            DEInvoiceReturnDetail invRDetail = new DEInvoiceReturnDetail();

            DEProduct product = new DEProduct();

            DateTime dateTime_From = Convert.ToDateTime(dtp_InvoiceDateFrom.Value);
            DateTime dateTime_To   = Convert.ToDateTime(dtp_InvoiceDateTo.Value.Date.AddHours(23.9));

            try
            {
                invDetail.Product_Id  = Convert.ToInt32(cbx_Product.SelectedItem.Col3);
                invRDetail.Product_Id = Convert.ToInt32(cbx_Product.SelectedItem.Col3);
                product.Product_Id    = Convert.ToInt32(cbx_Product.SelectedItem.Col3);
            }
            catch (Exception ex)
            {
                invDetail.Product_Id  = 0;
                invRDetail.Product_Id = 0;
                product.Product_Id    = 0;
            }



            DataTable dt_Sale   = new DataTable();
            DataTable dt_Return = new DataTable();

            dt_Sale   = obj_BLLInvoiceDetail.LoadInvoiceDetailTableForAllDataByInvoiceDate(invDetail, dateTime_From, dateTime_To);
            dt_Return = obj_BLLInvoiceReturnDetail.LoadInvoiceReturnDetailTableForAllDataByInvoiceDate(invRDetail, dateTime_From, dateTime_To);

            obj_BLLProduct.LoadProductRow(product);

            bindReport(product, dt_Sale, dt_Return);
        }
        private void rdo_isCarton_CheckedChanged(object sender, EventArgs e)
        {
            if (cbx_Product.Text.Trim().Length == 0 || cbx_Product.SelectedValue == null)
            {
                //MessageBox.Show("Invalid Product Code");
                cbx_Product.Text            = string.Empty;
                txt_ProductDescription.Text = string.Empty;
                txt_Rate.Text = string.Empty;
                cbx_Product.Focus();
            }
            else
            {
                //txt_ProductDescription.Text = cbx_Product.SelectedItem.Col2;

                DEProduct product = new DEProduct();
                product.Product_Id = Convert.ToInt32(cbx_Product.SelectedItem.Col3);

                BLLProduct obj_BLLProduct = new BLLProduct();

                bool bool_Result = obj_BLLProduct.LoadProductRow(product);

                if (bool_Result == true)
                {
                    if (rdo_Price1.Checked == true)
                    {
                        if (rdo_isCarton.Checked == true)
                        {
                            txt_Rate.Text = product.Carton_Price.ToString();
                        }
                        else if (rdo_isUnit.Checked == true)
                        {
                            txt_Rate.Text = product.Unit_Price.ToString();
                        }
                        else if (rdo_CartonPricePerUnits.Checked == true)
                        {
                            if (product.Carton_Price == 0)
                            {
                                txt_Rate.Text = "0.00";
                            }
                            else
                            {
                                txt_Rate.Text = (product.Carton_Price / product.NoOfUnitsPerCarton).ToString("##.##");
                            }
                        }
                    }
                    else
                    {
                        if (rdo_isCarton.Checked == true)
                        {
                            txt_Rate.Text = product.Carton_Price2.ToString();
                        }
                        else if (rdo_isUnit.Checked == true)
                        {
                            txt_Rate.Text = product.Unit_Price2.ToString();
                        }
                        else if (rdo_CartonPricePerUnits.Checked == true)
                        {
                            if (product.Carton_Price2 == 0)
                            {
                                txt_Rate.Text = "0.00";
                            }
                            else
                            {
                                txt_Rate.Text = (product.Carton_Price2 / product.NoOfUnitsPerCarton).ToString("##.##");
                            }
                        }
                    }

                    txt_Quantity.Focus();
                }
                else
                {
                    //MessageBox.Show("Invalid Product Code");
                    //cbx_Product.Text = string.Empty;
                    //txt_ProductDescription.Text = string.Empty;
                }

                obj_BLLProduct = null;
            }
        }
        private void cbx_Product_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (cbx_Product.Text.Trim().Length == 0 || cbx_Product.SelectedValue == null)
                {
                    cbx_Product.Text            = string.Empty;
                    txt_ProductDescription.Text = string.Empty;
                    txt_Rate.Text = string.Empty;
                    cbx_Product.Focus();
                }
                else
                {
                    txt_ProductDescription.Text = cbx_Product.SelectedItem.Col2;

                    DEProduct product = new DEProduct();
                    product.Product_Id = Convert.ToInt32(cbx_Product.SelectedItem.Col3);

                    BLLProduct obj_BLLProduct = new BLLProduct();

                    bool bool_Result = obj_BLLProduct.LoadProductRow(product);

                    if (bool_Result == true)
                    {
                        if (rdo_Price1.Checked == true)
                        {
                            if (rdo_isCarton.Checked == true)
                            {
                                txt_Rate.Text = product.Carton_Price.ToString();
                            }
                            else if (rdo_isUnit.Checked == true)
                            {
                                txt_Rate.Text = product.Unit_Price.ToString();
                            }
                            else if (rdo_CartonPricePerUnits.Checked == true)
                            {
                                txt_Rate.Text = (product.Carton_Price / product.NoOfUnitsPerCarton).ToString("##.##");
                            }
                        }
                        else
                        {
                            if (rdo_isCarton.Checked == true)
                            {
                                txt_Rate.Text = product.Carton_Price2.ToString();
                            }
                            else if (rdo_isUnit.Checked == true)
                            {
                                txt_Rate.Text = product.Unit_Price2.ToString();
                            }
                            else if (rdo_CartonPricePerUnits.Checked == true)
                            {
                                txt_Rate.Text = (product.Carton_Price2 / product.NoOfUnitsPerCarton).ToString("##.##");
                            }
                        }
                    }
                    else
                    {
                        cbx_Product.Text            = string.Empty;
                        txt_ProductDescription.Text = string.Empty;
                        cbx_Product.Focus();
                    }

                    obj_BLLProduct = null;
                }
            }
        }