Example #1
0
        private void button9_Click(object sender, EventArgs e)
        {
            MedicineSale ms = new MedicineSale(userId);

            ms.Show();
            this.Hide();
        }
        private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.nupAmount.Value = 0;
            if (cmbCategory.SelectedItem != null)
            {
                Guid categoryGuid             = new Guid(cmbCategory.SelectedItem.ToString());
                CompanyCollection companyList = new CompanyCollection();
                if (cmbCompany.SelectedItem == null)
                {
                    this.cmbCompany.DataSource    = companyList;
                    this.cmbCompany.DisplayMember = "DisplayName";
                }
            }
            this.nupAmount.Value = 0;
            if (cmbCategory.SelectedItem != null && cmbCompany.SelectedItem != null && cmbItem.SelectedItem != null)
            {
                availableStock = 0;
                Medicines m = new Medicines();
                availableStock               = m.GetMaxQuantityAvailable(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
                lblAvailableQuantity.Text    = "Max Available (" + availableStock.ToString() + " )";
                lblAvailableQuantity.Visible = true;

                MedicineSale MSale  = new MedicineSale();
                decimal      mrp    = MSale.GetMRP(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
                decimal      amount = mrp * (this.nupQuantity.Value);
                this.nupAmount.Value = amount;
            }
        }
 public MedicineSaleForm(MedicineSale medicine)
     : base(medicine)
 {
     this.mEntry = medicine;
     this.InitializeComponent();
     this.UserInitialize();
 }
        private void OnAddClick(object sender, EventArgs e)
        {
            MedicineSale obj = new MedicineSale();

            if (MedicineSaleForm.ShowForm(obj))
            {
                this.LoadListData(obj);
            }
        }
 private void nupQuantity_Leave(object sender, EventArgs e)
 {
     this.nupAmount.Value   = 0;
     this.nupQuantity.Value = 0;
     if (cmbCategory.SelectedItem != null && cmbCompany.SelectedItem != null && cmbItem.SelectedItem != null)
     {
         MedicineSale MSale  = new MedicineSale();
         decimal      mrp    = MSale.GetMRP(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
         decimal      amount = mrp * (this.nupQuantity.Value);
         this.nupAmount.Value = amount;
     }
 }
        public static bool ShowForm(MedicineSale obj)
        {
            bool r = false;

            if (!Objectbase.IsNullOrEmpty(obj))
            {
                using (MedicineSaleForm frm = new MedicineSaleForm(obj))
                {
                    r = frm.ShowDialog() == DialogResult.OK;
                }
            }
            return(r);
        }
        private void OnOpenClick(object sender, EventArgs e)
        {
            MedicineSale obj = this.GetSelected();

            if (obj != null)
            {
                obj.RefershData();
            }

            if (MedicineSaleForm.ShowForm(obj))
            {
                this.LoadListData(obj);
            }
        }
        private void cmbItem_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.nupAmount.Value = 0;
            if (cmbCategory.SelectedItem != null && cmbCompany.SelectedItem != null && cmbItem.SelectedItem != null)
            {
                availableStock = 0;
                Medicines m = new Medicines();
                availableStock               = m.GetMaxQuantityAvailable(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
                lblAvailableQuantity.Text    = "Max Available (" + availableStock.ToString() + " )";
                lblAvailableQuantity.Visible = true;

                MedicineSale MSale  = new MedicineSale();
                decimal      mrp    = MSale.GetMRP(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);
                decimal      amount = mrp * (this.nupQuantity.Value);
                this.nupAmount.Value = amount;
            }
        }
        private void LoadListData(MedicineSale selected)
        {
            int count = 0;

            this.LoadEntityList <MedicineSale>(this.dgvData, this.clmCategory.Index, new MedicineSaleCollection(tstSearch.Text), selected,
                                               delegate(DataGridViewRow row, MedicineSale obj)
            {
                count++;
                row.Cells[this.clmHaste.Index].Value    = obj.Haste;
                row.Cells[this.clmCategory.Index].Value = obj.CategoryName;
                row.Cells[this.clmItem.Index].Value     = obj.ItemName;
                row.Cells[this.clmQuantity.Index].Value = obj.Quantity;
                row.Cells[this.clmAmount.Index].Value   = obj.Amount;
            }
                                               );
            bool hasRows = count > 0;

            this.tsbOpen.Enabled = hasRows;
        }
        private void nupQuantity_Leave(object sender, EventArgs e)
        {
            this.nupAmount.Value   = 0;
            this.nupQuantity.Value = 0;
            if (cmbCategory.SelectedItem != null && cmbCompany.SelectedItem != null && cmbItem.SelectedItem != null)
            {
                MedicineSale MSale = new MedicineSale();
                decimal      mrp   = MSale.GetMRP(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item);

                if (nupQuantity.Text != "")
                {
                    //this.mEntry.Quantity = int.Parse(nupQuantity.Text);
                    decimal amount = mrp * int.Parse(this.nupQuantity.Text);
                    this.nupAmount.Value = amount;
                }
                else
                {
                    this.mEntry.Quantity = 0;
                }
            }
        }