Exemplo n.º 1
0
        public DSIssueBill.DTIssueBillDataTable PrintRecMedBill(RecieveMedicine Obj)
        {
            DSIssueBill.DTIssueBillDataTable dt = new DSIssueBill.DTIssueBillDataTable();
            try
            {
                string Qry = "select RecievedNumber as IssueNumber,RecieveDate as IssueDate,ItemName as MedicineName,Qty as Quantity,lt.PurchasePrice as Price,GrossAmount,NetAmount from ReceiveMedicine,LabTest lt" +
                             " where lt.ID=ReceiveMedicine.ItemNumber and ReceiveMedicine.RecievedNumber=" + Obj.RecieveNumber;
                //string Qry2 = "select RecievedNumber,RecieveDate,ItemName as MedicineName,Qty as Quantity,lt.RetailPrice as Price,GrossAmount,NetAmount from ReceiveMedicine,LabTest lt"+
                //             " where lt.ID=ReceiveMedicine.ItemNumber and ReceiveMedicine.RecievedNumber=" + Obj.RecieveNumber;

                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    //if (Retail == true)
                    //    da = new OleDbDataAdapter(Qry2, con);
                    //  else if (Purchase == true)
                    da = new OleDbDataAdapter(Qry, con);
                    da.Fill(dt);
                }


                return(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Exemplo n.º 2
0
 public void ClearControlls()
 {
     txtIssueNo.Text          = "";
     txtMedName.Text          = "";
     txtSearchMedicineID.Text = "";
     this.Current             = null;
 }
Exemplo n.º 3
0
        private void frmItemLedger_Load(object sender, EventArgs e)
        {
            labtests = new LabTestBLL().GetLabTests();
            rm       = new RecieveMedicine();
            List <LabTest> medicines = labtests.Where(m => m.IsMedicine == true || m.IsRsTenInjection == true || m.IsAlwaysPaid == true).ToList <LabTest>();

            labtests = null;
            labtests = medicines;
            cbxLabTest.DataSource    = labtests;
            cbxLabTest.DisplayMember = "TestName";
        }
Exemplo n.º 4
0
        private void NewRecipt()
        {
            rm = new RecieveMedicine();
            this.dgvRecieveMedicine.DataSource = null;
            txtQty.Text = "";

            txtID.Text        = "";
            txtNetAmount.Text = "";
            frm.Current       = null;
            GetNextReceiptNumber();
        }
Exemplo n.º 5
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();
                }
            }
        }
Exemplo n.º 6
0
 private void NewRecipt()
 {
     rm = new RecieveMedicine();
     this.dgvIssueMedicine.DataSource = null;
     txtQty.Text       = "";
     cbxLabTest.Text   = "";
     txtPrice.Text     = "";
     txtID.Text        = "";
     txtNetAmount.Text = "";
     cbxbranches.Text  = "";
     frm.Current       = null;
     GetNextReceiptNumber();
 }
Exemplo n.º 7
0
        private void lblSelect_Click(object sender, EventArgs e)
        {
            int L = Convert.ToInt32(dgvMedicines.CurrentRow.Cells["ID"].Value);

            if (dgvMedicines.CurrentRow != null)
            {
                if (dgvMedicines.CurrentRow.Cells[0].Value != null)
                {
                    this.Current = (RecieveMedicine)LoRec.Where(g => g.RefRec.LineItem.MedIssuedID == L).Single <RecieveMedicine>();
                }
            }
            this.Close();
        }
Exemplo n.º 8
0
        public List <RecieveMedicine> GetRecieveMedicines(string RecieveNumber)
        {
            List <RecieveMedicine> LoRec = new List <RecieveMedicine>();

            try
            {
                string    select = "Select * from ReceiveMedicine where RecievedNumber=" + RecieveNumber;
                DataTable dt     = new DataTable();
                con                  = new OleDbConnection();
                readconfile          = new ReadConfigFile();
                con.ConnectionString = readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    da = new OleDbDataAdapter(select, con);
                    da.Fill(dt);
                }

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        RecieveMedicine ObjRec = new RecieveMedicine();
                        ObjRec.RefRec.LineItem.LabTestId = Convert.ToInt32(row["ItemNumber"]);
                        ObjRec.RefRec.LineItem.TestName  = row["ItemName"].ToString();
                        //ObjRec.RefRec.LineItem.MedIssuedID = Convert.ToInt32(row["ID"]);
                        ObjRec.RefRec.Quantity = Convert.ToDecimal(row["Qty"]);
                        //ObjRec.RecieveDate = Convert.ToDateTime(row["RecieveDate"]);
                        //ObjRec.RecieveNumber = Convert.ToInt64(row["RecievedNumber"]);
                        ObjRec.RefRec.Price       = row["Price"] == DBNull.Value ? 0 : Convert.ToDouble(row["Price"]);
                        ObjRec.RefRec.GrossAmount = row["GrossAmount"] == DBNull.Value ? 0 : Convert.ToDouble(row["GrossAmount"]);
                        ObjRec.RefRec.NetAmount   = row["NetAmount"] == DBNull.Value ? 0 : Convert.ToDouble(row["NetAmount"]);

                        ObjRec.RefBranch.BranchID = row["BranchID"] == DBNull.Value ? 0 : Convert.ToInt16(row["BranchID"]);
                        LoRec.Add(ObjRec);
                    }
                }


                return(LoRec);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Exemplo n.º 9
0
        private void frmRecieveMedicine_Load(object sender, EventArgs e)
        {
            labtests = new LabTestBLL().GetLabTests();
            rm       = new RecieveMedicine();
            //List<LabTest> medicines = labtests.Where(m => m.IsMedicine == true || m.IsRsTenInjection ==true || m.IsAlwaysPaid ==true).ToList<LabTest>();
            //labtests = null;
            //labtests = medicines;
            cbxLabTest.DataSource    = labtests;
            cbxLabTest.DisplayMember = "TestName";
            cbxLabTest.ValueMember   = "LabTestId";
            GetNextReceiptNumber();
            txtID.Text = "";

            txtPrice.Text = "";
        }
 private void frmIsssuedMedicinePrice_Load(object sender, EventArgs e)
 {
     labtests = new LabTestBLL().GetLabTests();
     rm       = new RecieveMedicine();
     if (labtests.Count > 0)
     {
         List <LabTest> medicines = labtests.Where(m => m.IsMedicine == true || m.IsRsTenInjection == true || m.IsAlwaysPaid == true).ToList <LabTest>();
         labtests = null;
         labtests = medicines;
         cbxMedicines.DataSource    = labtests;
         cbxMedicines.DisplayMember = "TestName";
     }
     rbPurchase.Checked = true;
     rbAll.Checked      = false;
 }
Exemplo n.º 11
0
        private void frmRecieveMedicine_Load(object sender, EventArgs e)
        {
            labtests = new LabTestBLL().GetLabTests();
            rm       = new RecieveMedicine();
            //List<LabTest> medicines = labtests.Where(m => m.IsMedicine == true || m.IsRsTenInjection ==true || m.IsAlwaysPaid ==true).ToList<LabTest>();
            //labtests = null;
            //labtests = medicines;
            cbxLabTest.DataSource    = labtests;
            cbxLabTest.DisplayMember = "TestName";
            cbxLabTest.ValueMember   = "LabTestId";

            cbxbranches.DataSource    = new BranchBLL().GetBranchData();
            cbxbranches.DisplayMember = "BranchName";
            cbxbranches.ValueMember   = "BranchID";
            NewRecipt();
        }
Exemplo n.º 12
0
 public bool SaveRecieveMedicine(RecieveMedicine rm)
 {
     try
     {
         int VID = 0;
         con = new OleDbConnection();
         this.readconfile     = new ReadConfigFile();
         con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
         con.Open();
         tran = con.BeginTransaction();
         cmd  = new OleDbCommand("", con);
         //cmd.Connection = con;
         cmd.Transaction = tran;
         //cmd.CommandType = CommandType.Text;
         cmd.CommandText = "delete from ReceiveMedicine where RecievedNumber=" + rm.RecieveNumber;
         cmd.ExecuteNonQuery();
         OleDbCommand cmdSave = new OleDbCommand();
         cmdSave.Connection  = con;
         cmdSave.Transaction = tran;
         foreach (RecieveLineItem item in rm.Lines)
         {
             //if (rm.RefRec.LineItem.MedIssuedID == 0)
             //{
             if (item.LineItem.LabTestId > 0)
             {
                 cmdSave.CommandText = "Insert into ReceiveMedicine(RecieveDate,RecievedNumber,ItemNumber,ItemName,Qty,Price,GrossAmount,NetAmount) values (#" +
                                       rm.RecieveDate + "#," + rm.RecieveNumber + "," + item.LineItem.LabTestId + ",'" +
                                       item.LineItem.TestName + "'," + item.Quantity + "," + item.Price + "," + item.GrossAmount + "," + rm.RefRec.NetAmount + ")";
             }
             cmdSave.ExecuteNonQuery();
         }
         tran.Commit();
     }
     catch (Exception ex)
     {
         tran.Rollback();
         throw ex;
     }
     finally
     { con.Close(); }
     return(true);
 }
Exemplo n.º 13
0
 public frmPrintIssueMedByPrices(RecieveMedicine rm)
 {
     InitializeComponent();
     this.r = rm;
 }
Exemplo n.º 14
0
 public frmPrintReceiveMedBill(RecieveMedicine rm)
 {
     InitializeComponent();
     this.r = rm;
 }
Exemplo n.º 15
0
 public DSIssueBill.DTIssueBillDataTable PrintIssueMedBill(RecieveMedicine Obj, bool Retail, bool Purchase)
 {
     return(new InjectionLabTestDAL().PrintIssueMedBill(Obj, Retail, Purchase));
 }
Exemplo n.º 16
0
 public bool SaveIssuedMedicine(RecieveMedicine rm)
 {
     return(new InjectionLabTestDAL().SaveIssuedMedicine(rm));
 }
Exemplo n.º 17
0
 public DSIssueBill.DTIssueBillDataTable PrintRecMedBill(RecieveMedicine Obj)
 {
     return(new LabTestDAL().PrintRecMedBill(Obj));
 }
Exemplo n.º 18
0
 public bool SaveReceivedMedicine(RecieveMedicine rm)
 {
     return(new LabTestDAL().SaveRecieveMedicine(rm));
 }