Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtQty.Text.Length > 0)
            {
                object[]        values = { (LabTest)this.cbxLabTest.SelectedItem, this.txtQty.Text };
                RecieveLineItem rli    = new RecieveLineItem();
                rli.LineItem.LabTestId = ((LabTest)(this.cbxLabTest.SelectedItem)).LabTestId;
                rli.LineItem.TestName  = ((LabTest)(this.cbxLabTest.SelectedItem)).TestName;
                rli.Quantity           = Convert.ToInt32(this.txtQty.Text);
                rli.Price       = Convert.ToDouble(txtPrice.Text);
                rli.GrossAmount = Convert.ToDouble(txtGrossAmount.Text);

                if (!rm.Lines.Contains(rli))
                {
                    rm.Lines.Add(rli);
                }
                else
                {
                    RecieveLineItem rtemp = rm.Lines[rm.Lines.IndexOf(rli)];
                    rtemp = rli;
                    rm.Lines[rm.Lines.IndexOf(rli)] = rtemp;
                }
                rm.RecieveDate = this.dtpIssueDate.Value.Date;
                this.dgvIssueMedicine.DataSource = null;
                this.dgvIssueMedicine.DataSource = rm.Lines;

                for (int i = 0; i <= dgvIssueMedicine.Rows.Count; i++)
                {
                    dgvIssueMedicine.Columns["NetAmount"].Visible = false;
                }
                this.dgvIssueMedicine.Columns[0].Width      = 160;
                this.dgvIssueMedicine.Columns[0].HeaderText = "Medicine Name";
            }

            int qty;

            if (string.IsNullOrEmpty(txtQty.Text))
            {
                qty = 0;
            }
            else
            {
                qty = Convert.ToInt16(txtQty.Text);
            }

            if (medcheck3() < qty)
            {
                MessageBox.Show("Recieved quantity of " + cbxLabTest.SelectedItem.ToString() + " is: " + medcheck().ToString() + Environment.NewLine + "Consumed: " + medcheck2().ToString() + Environment.NewLine + "Net Quantity: " + medcheck3().ToString());
                return;
            }
            txtQty.Text         = "";
            txtPrice.Text       = "";
            txtGrossAmount.Text = "";
            cbxLabTest.Text     = "";
            txtNetAmount.Text   = GetNetTotal().ToString();
            dgvIssueMedicine.ClearSelection();
            cbxLabTest.Focus();
        }
Пример #2
0
        private void tsEdit_Click_1(object sender, EventArgs e)
        {
            frm.ShowDialog();
            rm.Lines.Clear();
            dgvRecieveMedicine.DataSource = null;
            dgvRecieveMedicine.DataSource = rm.Lines;
            if (frm.Current != null)
            {
                dtpReceiveDate.Text   = frm.Current.RecieveDate.ToShortDateString();
                txtRecieveNumber.Text = frm.Current.RecieveNumber.ToString();

                txtNetAmount.Text = frm.Current.RefRec.NetAmount.ToString();
                txtID.Text        = frm.Current.RefRec.LineItem.MedIssuedID.ToString();
                LoRec             = new LabTestBLL().GetRecieveMedicines(txtRecieveNumber.Text.ToString());
                rm = new RecieveMedicine();
                rm.RecieveNumber = Convert.ToInt64(txtRecieveNumber.Text);
                foreach (var item in LoRec)
                {
                    RecieveLineItem rli = new RecieveLineItem();
                    rli.LineItem.LabTestId = item.RefRec.LineItem.LabTestId;
                    rli.LineItem.TestName  = item.RefRec.LineItem.TestName;
                    rli.Quantity           = item.Quantity;
                    rli.Price       = item.RefRec.Price;
                    rli.GrossAmount = item.RefRec.GrossAmount;

                    cbxbranches.SelectedValue = item.RefBranch.BranchID;

                    if (!rm.Lines.Contains(rli))
                    {
                        rm.Lines.Add(rli);
                    }
                    else
                    {
                        RecieveLineItem rtemp = rm.Lines[rm.Lines.IndexOf(rli)];
                        rtemp = rli;
                        rm.Lines[rm.Lines.IndexOf(rli)] = rtemp;
                    }
                    dgvRecieveMedicine.DataSource = null;
                    dgvRecieveMedicine.DataSource = rm.Lines;
                    for (int i = 0; i < dgvRecieveMedicine.Columns.Count; i++)
                    {
                        dgvRecieveMedicine.Columns[i].Visible             = true;
                        dgvRecieveMedicine.Columns["LineItem"].HeaderText = "Medicine Name";
                        dgvRecieveMedicine.Columns["LineItem"].Width      = 160;
                        dgvRecieveMedicine.Columns["Quantity"].Width      = 100;
                        dgvRecieveMedicine.Columns["NetAmount"].Visible   = false;
                    }

                    dgvRecieveMedicine.ClearSelection();
                }
            }
        }
Пример #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtQty.Text.Length > 0)
            {
                object[]        values = { (LabTest)this.cbxLabTest.SelectedItem, this.txtQty.Text };
                RecieveLineItem rli    = new RecieveLineItem();
                rli.LineItem.LabTestId = ((LabTest)(this.cbxLabTest.SelectedItem)).LabTestId;
                rli.LineItem.TestName  = ((LabTest)(this.cbxLabTest.SelectedItem)).TestName;
                rli.Quantity           = Convert.ToInt32(this.txtQty.Text);
                rli.Price       = Convert.ToDouble(txtPrice.Text);
                rli.GrossAmount = Convert.ToDouble(txtGrossAmount.Text);
                if (!rm.Lines.Contains(rli))
                {
                    rm.Lines.Add(rli);
                }
                else
                {
                    RecieveLineItem rtemp = rm.Lines[rm.Lines.IndexOf(rli)];
                    rtemp = rli;
                    rm.Lines[rm.Lines.IndexOf(rli)] = rtemp;
                }
                rm.RecieveDate = this.dtpReceiveDate.Value.Date;
                this.dgvRecieveMedicine.DataSource = null;
                this.dgvRecieveMedicine.DataSource = rm.Lines;

                for (int i = 0; i <= dgvRecieveMedicine.Rows.Count; i++)
                {
                    dgvRecieveMedicine.Columns["NetAmount"].Visible = false;
                }
                this.dgvRecieveMedicine.Columns[0].Width      = 160;
                this.dgvRecieveMedicine.Columns[0].HeaderText = "Medicine Name";
            }
            txtQty.Text         = "";
            txtPrice.Text       = "";
            txtGrossAmount.Text = "";
            //
            txtNetAmount.Text = GetNetTotal().ToString();
            dgvRecieveMedicine.ClearSelection();
            cbxLabTest.Focus();
        }